1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = '../lib'; 6 require './test.pl'; # for which_perl() etc 7 plan(3); 8} 9 10my $Perl = which_perl(); 11 12my $filename = tempfile(); 13 14$x = `$Perl -le "print 'ok';"`; 15 16is($x, "ok\n", "Got expected 'perl -le' output"); 17 18open(try,">$filename") || (die "Can't open temp file."); 19print try 'print "ok\n";'; print try "\n"; 20close try or die "Could not close: $!"; 21 22$x = `$Perl $filename`; 23 24is($x, "ok\n", "Got expected output of command from script"); 25 26$x = `$Perl <$filename`; 27 28is($x, "ok\n", "Got expected output of command read from script"); 29