From: Peter Rabbitson Date: Tue, 24 Aug 2010 07:38:11 +0000 (+0200) Subject: Fix the taint mode test to correctly work under local-lib or similar X-Git-Tag: v0.08124~100 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f72d93abcf470e73b310c24d8ce09f8a814b7e5;p=dbsrgits%2FDBIx-Class.git Fix the taint mode test to correctly work under local-lib or similar --- diff --git a/Changes b/Changes index d7ffe6a..7683396 100644 --- a/Changes +++ b/Changes @@ -20,6 +20,7 @@ Revision history for DBIx::Class via custom accessors - Fixed ::Schema::Versioned to work properly with quoting on (RT#59619) + - Fixed t/54taint fails under local-lib * Misc - Refactored capability handling in Storage::DBI, allows for diff --git a/t/54taint.t b/t/54taint.t index db350d7..3ab675f 100644 --- a/t/54taint.t +++ b/t/54taint.t @@ -6,6 +6,17 @@ use strict; 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 +use Config; +BEGIN { + for (map { defined $ENV{$_} ? $ENV{$_} : () } (qw/PERLLIB PERL5LIB/) ) { # we unshift, so reverse precedence + my ($envvar) = ($_ =~ /^(.+)$/); # untaint + unshift @INC, map { length($_) ? $_ : () } (split /\Q$Config{path_sep}\E/, $envvar); + } +} + use Test::More; use Test::Exception; use lib qw(t/lib);