Apparently this is more stable historically... boggle
[dbsrgits/DBIx-Class.git] / t / 54taint.t
index 573e3c0..65b5315 100644 (file)
@@ -12,14 +12,21 @@ use warnings;
 use Config;
 BEGIN {
   for (map { defined $ENV{$_} ? $ENV{$_} : () } (qw/PERLLIB PERL5LIB/) ) {  # we unshift, so reverse precedence
-    my ($envvar) = ($_ =~ /^(.+)$/);  # untaint
+    my ($envvar) = ($_ =~ /^(.*)$/s);  # untaint
     unshift @INC, map { length($_) ? $_ : () } (split /\Q$Config{path_sep}\E/, $envvar);
   }
 }
 
+# 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
+# installed DBIx::Class will take precedence over the one we're trying to test.
+# In some cases, prove will have supplied ./lib as an absolute path so it
+# doesn't seem worth trying to remove the second copy since it won't hurt
+# anything.
+use lib qw(t/lib lib);
+
 use Test::More;
 use Test::Exception;
-use lib qw(t/lib);
 use DBICTest;
 
 throws_ok (