Silence some warnings introduced by #33507
[p5sagit/p5-mst-13.2.git] / ext / IO / t / io_taint.t
CommitLineData
b454f38b 1#!./perl -T
2
3BEGIN {
4 unless(grep /blib/, @INC) {
5 chdir 't' if -d 't';
20822f61 6 @INC = '../lib';
b454f38b 7 }
8}
9
10use Config;
11
12BEGIN {
90b9a713 13 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') {
14 print "1..0\n";
15 exit 0;
b454f38b 16 }
17}
18
19END { unlink "./__taint__$$" }
20
21print "1..3\n";
22use IO::File;
23$x = new IO::File "> ./__taint__$$" || die("Cannot open ./__taint__$$\n");
24print $x "$$\n";
25$x->close;
26
27$x = new IO::File "< ./__taint__$$" || die("Cannot open ./__taint__$$\n");
28chop($unsafe = <$x>);
29eval { kill 0 * $unsafe };
2986a63f 30print "not " if ((($^O ne 'MSWin32') && ($^O ne 'NetWare')) and ($@ !~ /^Insecure/o));
b454f38b 31print "ok 1\n";
32$x->close;
33
34# We could have just done a seek on $x, but technically we haven't tested
35# seek yet...
36$x = new IO::File "< ./__taint__$$" || die("Cannot open ./__taint__$$\n");
37$x->untaint;
38print "not " if ($?);
39print "ok 2\n"; # Calling the method worked
40chop($unsafe = <$x>);
41eval { kill 0 * $unsafe };
42print "not " if ($@ =~ /^Insecure/o);
43print "ok 3\n"; # No Insecure message from using the data
44$x->close;
45
46exit 0;