From: Graham Knop Date: Sat, 8 Feb 2014 09:34:52 +0000 (+0100) Subject: Really fix @INC munging of the taint test X-Git-Tag: v0.082800~242 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8de639b29afc6645820ba346b47d53117dbbe7e;p=dbsrgits%2FDBIx-Class.git Really fix @INC munging of the taint test Now runs even with a plain `perl t/54taint.t` --- diff --git a/t/54taint.t b/t/54taint.t index 65b5315..d6e3535 100644 --- a/t/54taint.t +++ b/t/54taint.t @@ -8,14 +8,16 @@ use warnings; # When in taint mode, PERL5LIB is ignored (but *not* unset) # Put it back in INC so that local-lib users can actually -# run this test +# run this test. Use lib.pm instead of an @INC unshift as +# it will correctly add any arch subdirs encountered use Config; -BEGIN { - for (map { defined $ENV{$_} ? $ENV{$_} : () } (qw/PERLLIB PERL5LIB/) ) { # we unshift, so reverse precedence - my ($envvar) = ($_ =~ /^(.*)$/s); # untaint - unshift @INC, map { length($_) ? $_ : () } (split /\Q$Config{path_sep}\E/, $envvar); - } -} + +use lib ( + grep { length } + map { split /\Q$Config{path_sep}\E/, (/^(.*)$/)[0] } # untainting regex + grep { defined } + @ENV{qw(PERL5LIB PERLLIB)} # precedence preserved by lib +); # We need to specify 'lib' here as well because even if it was already in # @INC, the above will have put our local::lib in front of it, so now an