X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/7b4499e347dfca2b50bfa1d8a0c6ca1419976fbc..b9021e9738004ee35018d3ec16495b7dc1a287f0:/selfforum-cgi/shared/CheckRFC.pm diff --git a/selfforum-cgi/shared/CheckRFC.pm b/selfforum-cgi/shared/CheckRFC.pm index d1731d2..b43d723 100644 --- a/selfforum-cgi/shared/CheckRFC.pm +++ b/selfforum-cgi/shared/CheckRFC.pm @@ -4,7 +4,7 @@ package CheckRFC; # # # File: shared/CheckRFC.pm # # # -# Authors: Andre Malo , 2001-04-14 # +# Authors: André Malo # # # # Description: implement several string checks on RFC correctness # # # @@ -17,7 +17,6 @@ use vars qw( @email @EXPORT @ISA - $VERSION ); $v56 = eval q[ @@ -27,9 +26,15 @@ $v56 = eval q[ use Carp qw(croak); +################################################################################ +# # Version check # -$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +# last modified: +# $Date$ (GMT) +# by $Author$ +# +sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'} ################################################################################ # @@ -56,8 +61,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 +102,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 +115,6 @@ sub is_email ($;$) { # remove nested comments 1 while ($string =~ s/\([^()]*\)//g); - #$string =~ s/^\s+//; - #$string =~ s/\s+$//; return ($string =~ /^$email[0]$/) unless $strict; @@ -307,7 +314,7 @@ BEGIN { } } -# keeping require happy +# keep 'require' happy 1; #