X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/ec35b096491af3d6993be62819090f617f98756b..36a693697d4459b0b91ca33448698618ba4da518:/selfforum-cgi/shared/CheckRFC.pm diff --git a/selfforum-cgi/shared/CheckRFC.pm b/selfforum-cgi/shared/CheckRFC.pm index 6f8fa49..d1731d2 100644 --- a/selfforum-cgi/shared/CheckRFC.pm +++ b/selfforum-cgi/shared/CheckRFC.pm @@ -17,6 +17,7 @@ use vars qw( @email @EXPORT @ISA + $VERSION ); $v56 = eval q[ @@ -26,6 +27,10 @@ $v56 = eval q[ use Carp qw(croak); +# Version check +# +$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + ################################################################################ # # Export @@ -53,25 +58,27 @@ require Exporter; # sub is_URL ($@) { my ($string, @schemes) = @_; + my $scheme; return unless (defined ($string) and length ($string)); @schemes = qw(http) unless (@schemes); @schemes = keys %url if (@schemes == 1 and $schemes[0] eq ':ALL'); - for (@schemes) { - croak "unknown url scheme '$_'" unless exists $url{$_}; - unless (/mailto/) { - return 1 if ($string =~ /$url{$_}/); + for $scheme (@schemes) { + croak "unknown url scheme '$scheme'" unless exists $url{$scheme}; + unless ($scheme =~ /mailto/) { + return 1 if ($string =~ /$url{$scheme}/); } else { - return unless ($string =~ /^mailto:(.+)/); - - if ($_ eq 'mailto') { - return 1 if (is_email ($1)); - } - elsif ($_ eq 'strict_mailto') { - return 1 if (is_email ($1,1)); + if ($string =~ /^mailto:(.+)/) { + + if ($scheme eq 'mailto') { + return 1 if (is_email ($1)); + } + elsif ($scheme eq 'strict_mailto') { + return 1 if (is_email ($1,1)); + } } } }