This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add Scalar-List-Utils 1.02, from Graham Barr.
[perl5.git] / t / lib / u-tainted.t
... / ...
CommitLineData
1#!./perl -T
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8use lib qw(blib/lib blib/arch);
9use Scalar::Util qw(tainted);
10use Config;
11
12print "1..5\n";
13
14print "not " if tainted(1);
15print "ok 1\n";
16
17my $var = 2;
18
19print "not " if tainted($var);
20print "ok 2\n";
21
22my $key = (keys %ENV)[0];
23
24$var = $ENV{$key};
25
26print "not " unless tainted($var);
27print "ok 3\n";
28
29print "not " unless tainted($ENV{$key});
30print "ok 4\n";
31
32print "not " if @ARGV and not tainted($ARGV[0]);
33print "ok 5\n";