1#!./perl -Tw 2# Testing Cwd under taint mode. 3 4use Cwd; 5BEGIN { 6 chdir 't' if -d 't'; 7} 8 9use strict; 10use Test::More tests => 16; 11use Scalar::Util qw/tainted/; 12 13my @Functions = qw(getcwd cwd fastcwd fastgetcwd 14 abs_path fast_abs_path 15 realpath fast_realpath 16 ); 17 18foreach my $func (@Functions) { 19 no strict 'refs'; 20 my $cwd; 21 eval { $cwd = &{'Cwd::'.$func} }; 22 is( $@, '', "$func() should not explode under taint mode" ); 23 ok( tainted($cwd), "its return value should be tainted" ); 24} 25