From: Nicholas Clark Date: Sat, 12 Sep 2009 07:12:59 +0000 (+0100) Subject: Untangle File::Basename and re - avoid hard-coding the hints value. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0105f2b1236b169342446129a0de2fd073540afd;p=p5sagit%2Fp5-mst-13.2.git Untangle File::Basename and re - avoid hard-coding the hints value. --- diff --git a/ext/re/re.pm b/ext/re/re.pm index 742a018..d9b854d 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -11,20 +11,11 @@ our @EXPORT_OK = ('regmust', regname regnames regnames_count)); our %EXPORT_OK = map { $_ => 1 } @EXPORT_OK; -# *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** -# -# If you modify these values see comment below! - my %bitmask = ( taint => 0x00100000, # HINT_RE_TAINT eval => 0x00200000, # HINT_RE_EVAL ); -# - File::Basename contains a literal for 'taint' as a fallback. If -# taint is changed here, File::Basename must be updated as well. -# -# *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** - sub setcolor { eval { # Ignore errors require Term::Cap; diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm index b3fe0ac..d842844 100644 --- a/lib/File/Basename.pm +++ b/lib/File/Basename.pm @@ -37,13 +37,13 @@ is equivalent to the original path for all systems but VMS. package File::Basename; -# A bit of juggling to insure that C always works, since # File::Basename is used during the Perl build, when the re extension may -# not be available. +# not be available, but we only actually need it if running under tainting. BEGIN { - unless (eval { require re; }) - { eval ' sub re::import { $^H |= 0x00100000; } ' } # HINT_RE_TAINT - import re 'taint'; + if (${^TAINT}) { + require re; + re->import('taint'); + } } @@ -54,7 +54,7 @@ our(@ISA, @EXPORT, $VERSION, $Fileparse_fstype, $Fileparse_igncase); require Exporter; @ISA = qw(Exporter); @EXPORT = qw(fileparse fileparse_set_fstype basename dirname); -$VERSION = "2.77"; +$VERSION = "2.78"; fileparse_set_fstype($^O);