case '\011': /* $^I, NOT \t in EBCDIC */
case '\016': /* $^N */
case '\020': /* $^P */
- case '\024': /* $^T */
if (len > 1)
break;
goto magicalize;
if (len > 1)
break;
goto ro_magicalize;
+ case '\024': /* $^T */
+ if (len == 1)
+ goto magicalize;
+ else if (strEQ(name, "\024AINT"))
+ goto ro_magicalize;
+ else
+ break;
case '\027': /* $^W & $^WARNING_BITS */
if (len > 1 && strNE(name, "\027ARNING_BITS")
&& strNE(name, "\027IDE_SYSTEM_CALLS"))
}
break;
case '\024': /* ^T */
+ if (*(mg->mg_ptr+1) == '\0') {
#ifdef BIG_TIME
- sv_setnv(sv, PL_basetime);
+ sv_setnv(sv, PL_basetime);
#else
- sv_setiv(sv, (IV)PL_basetime);
+ sv_setiv(sv, (IV)PL_basetime);
#endif
- break;
+ }
+ else if (strEQ(mg->mg_ptr, "\024AINT"))
+ sv_setiv(sv, PL_tainting);
+ break;
case '\027': /* ^W & $^WARNING_BITS & ^WIDE_SYSTEM_CALLS */
if (*(mg->mg_ptr+1) == '\0')
sv_setiv(sv, (IV)((PL_dowarn & G_WARN_ON) ? TRUE : FALSE));
epoch (beginning of 1970). The values returned by the B<-M>, B<-A>,
and B<-C> filetests are based on this value.
+=item ${^TAINT}
+
+Reflects if taint mode is on or off (ie. if the program was run with
+B<-T> or not). True for on, false for off.
+
=item $PERL_VERSION
=item $^V
return 1;
}
-print "1..41\n";
+print "1..43\n";
$Is_MSWin32 = $^O eq 'MSWin32';
$Is_NetWare = $^O eq 'NetWare';
ok $^S == 0;
eval { ok $^S == 1 };
ok $^S == 0;
+
+ok ${^TAINT} == 0;
+eval { ${^TAINT} = 1 };
+ok ${^TAINT} == 0;
use strict;
use Config;
+my $test = 177;
+sub ok {
+ my($ok, $name) = @_;
+
+ # You have to do it this way or VMS will get confused.
+ print $ok ? "ok $test - $name\n" : "not ok $test - $name\n";
+
+ printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+
+ $test++;
+ return $ok;
+}
+
+
$| = 1;
# We do not want the whole taint.t to fail
close PROG;
my $echo = "$Invoke_Perl $ECHO";
-print "1..176\n";
+print "1..179\n";
# First, let's make sure that Perl is checking the dangerous
# environment variables. Maybe they aren't set yet, so we'll
}
+ok( ${^TAINT}, '$^TAINT is on' );
+
+eval { ${^TAINT} = 0 };
+ok( ${^TAINT}, '$^TAINT is not assignable' );
+ok( $@ =~ /^Modification of a read-only value attempted/,
+ 'Assigning to taint pukes properly' );
+