return $var;
}
+sub url_decode {
+ my ($todecode) = (@_);
+ $todecode =~ tr/+/ /; # pluses become spaces
+ $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
+ return $todecode;
+}
+
sub i_am_cgi () {
# I use SERVER_SOFTWARE because it's required to be
# defined for all requests in the CGI spec.
value_quote($var);
xml_quote($var);
+ # Functions for decoding
+ $rv = url_decode($var);
+
# Functions that tell you about your environment
my $is_cgi = i_am_cgi();
# Cryptographic Functions
$crypted_password = bz_crypt($password);
+ # Validation Functions
+ check_email_syntax($email);
+
=head1 DESCRIPTION
This package contains various utility functions which do not belong anywhere
is kept separate from html_quote partly for compatibility with previous code
(for ') and partly for future handling of non-ASCII characters.
+=item C<url_decode($val)>
+
+Converts the %xx encoding from the given URL back to its original form.
+
=item C<i_am_cgi()>
Tells you whether or not you are being run as a CGI script in a web
=end undocumented
=back
+
+=head2 Validation
+
+=over 4
+
+=item C<check_email_syntax($email)>
+
+Do a syntax checking for a legal email address. An error is thrown
+if the validation fails.
+
+=back
# Implementations of several of the below were blatently stolen from CGI.pm,
# by Lincoln D. Stein.
-# Get rid of all the %xx encoding and the like from the given URL.
-sub url_decode {
- my ($todecode) = (@_);
- $todecode =~ tr/+/ /; # pluses become spaces
- $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
- return $todecode;
-}
-
# check and see if a given field exists, is non-empty, and is set to a
# legal value. assume a browser bug and abort appropriately if not.
# if $legalsRef is not passed, just check to make sure the value exists and