This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE
[perl5.git] / t / lib / u-tainted.t
CommitLineData
f4a2945e
JH
1#!./perl -T
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6b05f64e
PP
6 require Config; import Config;
7 if ($Config{extensions} !~ /\bList\/Util\b/) {
8 print "1..0 # Skip: List::Util was not built\n";
9 exit 0;
10 }
f4a2945e
JH
11}
12
13use lib qw(blib/lib blib/arch);
14use Scalar::Util qw(tainted);
15use Config;
16
17print "1..5\n";
18
19print "not " if tainted(1);
20print "ok 1\n";
21
22my $var = 2;
23
24print "not " if tainted($var);
25print "ok 2\n";
26
27my $key = (keys %ENV)[0];
28
29$var = $ENV{$key};
30
31print "not " unless tainted($var);
32print "ok 3\n";
33
34print "not " unless tainted($ENV{$key});
35print "ok 4\n";
36
37print "not " if @ARGV and not tainted($ARGV[0]);
38print "ok 5\n";