1#!./perl -Tw 2# [perl #33173] shellwords.pl and tainting 3 4use strict; 5use warnings; 6 7BEGIN { 8 if ( $ENV{PERL_CORE} ) { 9 require Config; 10 no warnings 'once'; 11 if ($Config::Config{extensions} !~ /\bList\/Util\b/) { 12 print "1..0 # Skip: Scalar::Util was not built\n"; 13 exit 0; 14 } 15 if (exists($Config::Config{taint_support}) && not $Config::Config{taint_support}) { 16 print "1..0 # Skip: your perl was built without taint support\n"; 17 exit 0; 18 } 19 } 20} 21 22use Text::ParseWords qw(shellwords old_shellwords); 23use Scalar::Util qw(tainted); 24 25print "1..2\n"; 26 27print "not " if grep { not tainted($_) } shellwords("$0$^X"); 28print "ok 1\n"; 29 30print "not " if grep { not tainted($_) } old_shellwords("$0$^X"); 31print "ok 2\n"; 32