1 with -T, and -1 with -t or -TU.
p4raw-id: //depot/perl@18453
#endif
}
else if (strEQ(mg->mg_ptr, "\024AINT"))
- sv_setiv(sv, PL_tainting);
+ sv_setiv(sv, PL_tainting
+ ? (PL_taint_warn || PL_unsafe ? -1 : 1)
+ : 0);
break;
case '\027': /* ^W & $^WARNING_BITS & ^WIDE_SYSTEM_CALLS */
if (*(mg->mg_ptr+1) == '\0')
=item ${^TAINT}
-Reflects if taint mode is on or off (i.e. if the program was run with
-B<-T> or not). True for on, false for off.
+Reflects if taint mode is on or off. 1 for on (the program was run with
+B<-T>), 0 for off, -1 when only taint warnings are enabled (i.e. with
+B<-t> or B<-TU>).
=item $PERL_VERSION
}
-ok( ${^TAINT}, '$^TAINT is on' );
+ok( ${^TAINT} == 1, '$^TAINT is on' );
eval { ${^TAINT} = 0 };
ok( ${^TAINT}, '$^TAINT is not assignable' );
try({PERL5OPT => '-t'},
['-e', 'print ${^TAINT}'],
- '1',
+ '-1',
'');
try({PERLLIB => "foobar$Config{path_sep}42"},
local $SIG{__WARN__} = sub { $warning = join "\n", @_; };
my $Tmsg = 'while running with -t switch';
-ok( ${^TAINT}, '${^TAINT} defined' );
+is( ${^TAINT}, -1, '${^TAINT} == -1' );
my $out = `$Perl -le "print q(Hello)"`;
is( $out, "Hello\n", '`` worked' );