From: Rafael Garcia-Suarez Date: Mon, 6 Jan 2003 20:31:43 +0000 (+0000) Subject: Change the value of ${^TAINT} : 0 without taint checks, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9aa05f5803ebfde70aac285fc58e97e64abbc2b4;p=p5sagit%2Fp5-mst-13.2.git Change the value of ${^TAINT} : 0 without taint checks, 1 with -T, and -1 with -t or -TU. p4raw-id: //depot/perl@18453 --- diff --git a/mg.c b/mg.c index 408c7de..bdf204b 100644 --- a/mg.c +++ b/mg.c @@ -658,7 +658,9 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) #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') diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 1a71142..271633e 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -1105,8 +1105,9 @@ and B<-C> filetests are based on this value. =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 diff --git a/t/op/taint.t b/t/op/taint.t index 4b8039c..686354e 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -904,7 +904,7 @@ else { } -ok( ${^TAINT}, '$^TAINT is on' ); +ok( ${^TAINT} == 1, '$^TAINT is on' ); eval { ${^TAINT} = 0 }; ok( ${^TAINT}, '$^TAINT is not assignable' ); diff --git a/t/run/runenv.t b/t/run/runenv.t index 9acad00..df4a778 100644 --- a/t/run/runenv.t +++ b/t/run/runenv.t @@ -150,7 +150,7 @@ try({PERL5OPT => '-w -w'}, try({PERL5OPT => '-t'}, ['-e', 'print ${^TAINT}'], - '1', + '-1', ''); try({PERLLIB => "foobar$Config{path_sep}42"}, diff --git a/t/run/switcht.t b/t/run/switcht.t index 869605f..f48124e 100644 --- a/t/run/switcht.t +++ b/t/run/switcht.t @@ -14,7 +14,7 @@ my $warning; 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' );