2 # t/taint-mode.t: checks that local::lib sets up @INC correctly when
3 # included in a script that has taint mode on, and is executing in an
4 # environment in which local::lib has already been loaded.
9 use Test::More tests => 1;
10 use File::Temp 'tempfile';
13 use lib 't/lib'; use TempDir;
15 my $dir1 = mk_temp_dir('test_local_lib-XXXXX');
17 # Set up local::lib environment using our temp dir
19 local::lib->import($dir1);
21 # Create a script that has taint mode turned on, and tries to use a
22 # local lib to the same temp dir.
23 my ($fh, $filename) = tempfile('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), UNLINK => 1);
27 use strict; use warnings;
29 my \$dir = "\Q$dir1\E";
30 local::lib->import(\$dir);
31 warn "using lib dir \$dir\\n";
32 if (grep { m{^\\Q\$dir} } \@INC) {
35 warn '\@INC is: ', join("\\n", \@INC), "\\n";
40 my $exit_val = system($^X, '-Ilib', '-T', $filename);
42 is($exit_val >> 8, 0, 'test script exited with 0, local::lib dir found in @INC');