From: ndparker <> Date: Thu, 28 Jun 2001 13:15:08 +0000 (+0000) Subject: if is_email and is_URL are called without a parameter, now $_ will be evaluated X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/7af1e45967d6d5eb01e6eee642380123ba88be07?ds=sidebyside if is_email and is_URL are called without a parameter, now $_ will be evaluated --- diff --git a/selfforum-cgi/shared/CheckRFC.pm b/selfforum-cgi/shared/CheckRFC.pm index d1731d2..b000dcf 100644 --- a/selfforum-cgi/shared/CheckRFC.pm +++ b/selfforum-cgi/shared/CheckRFC.pm @@ -56,8 +56,9 @@ require Exporter; # # Return: Status code (Bool) # -sub is_URL ($@) { +sub is_URL (;$@) { my ($string, @schemes) = @_; + $string = $_ unless defined $string; my $scheme; return unless (defined ($string) and length ($string)); @@ -96,8 +97,11 @@ sub is_URL ($@) { # # Return: Status code (Bool) # -sub is_email ($;$) { +sub is_email (;$$) { my $string = shift; + $string = $_ unless defined $string; + return unless defined $string; + my $strict = shift; # false if any non-ascii chars @@ -106,8 +110,6 @@ sub is_email ($;$) { # remove nested comments 1 while ($string =~ s/\([^()]*\)//g); - #$string =~ s/^\s+//; - #$string =~ s/\s+$//; return ($string =~ /^$email[0]$/) unless $strict;