11 my $Perl = which_perl();
14 local $SIG{__WARN__} = sub { $warning = join "\n", @_; };
15 my $Tmsg = 'while running with -t switch';
17 is( ${^TAINT}, -1, '${^TAINT} == -1' );
19 my $out = `$Perl -le "print q(Hello)"`;
20 is( $out, "Hello\n", '`` worked' );
21 like( $warning, qr/^Insecure .* $Tmsg/, ' taint warn' );
26 my $out = `$Perl -le "print q(Hello)"`;
27 is( $out, "Hello\n", '`` worked' );
28 is( $warning, '', ' no warnings "taint"' );
31 # Get ourselves a tainted variable.
32 my $filename = tempfile();
34 $file =~ s/.*/$filename/;
35 ok( open(FILE, ">$file"), 'open >' ) or DIE $!;
38 like( $warning, qr/^Insecure dependency in open $Tmsg/, 'open > taint warn' );
39 ok( -e $file, ' file written' );
42 like( $warning, qr/^Insecure dependency in unlink $Tmsg/,
43 'unlink() taint warn' );
44 ok( !-e $file, 'unlink worked' );
46 ok( !$^W, "-t doesn't enable regular warnings" );