taint.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!./perl -Tw
# Testing Cwd under taint mode.
use Cwd;
BEGIN {
chdir 't' if -d 't';
}
use strict;
use Test::More tests => 16;
use Scalar::Util qw/tainted/;
my @Functions = qw(getcwd cwd fastcwd fastgetcwd
abs_path fast_abs_path
realpath fast_realpath
);
foreach my $func (@Functions) {
no strict 'refs';
my $cwd;
eval { $cwd = &{'Cwd::'.$func} };
is( $@, '', "$func() should not explode under taint mode" );
ok( tainted($cwd), "its return value should be tainted" );
}