X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/7b4499e347dfca2b50bfa1d8a0c6ca1419976fbc..e0e1833d60647df91b471bff59ba257fa202eb36:/selfforum-cgi/shared/CheckRFC.pm?ds=sidebyside 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;