8 $SIG{__WARN__} = sub { die "Dying on warning: ", @_ };
12 my ($n, $result, $info) = @_;
18 print "# $info\n" if $info;
24 eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval
25 ok 1, `echo \$foo` eq "hi there\n";
27 unlink 'ajslkdfpqjsjfk';
29 open(FOO,'ajslkdfpqjsjfk');
31 close FOO; # just mention it, squelch used-only-once
33 # the next tests are embedded inside system simply because sh spits out
34 # a newline onto stderr when a child process kills itself with SIGINT.
36 system './perl', '-e', <<'END';
38 $| = 1; # command buffering
40 $SIG{"INT"} = "ok3"; kill "INT",$$;
41 $SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";
42 $SIG{"INT"} = "DEFAULT"; kill 2,$$; print "not ok\n";
45 if (($x = pop(@_)) eq "INT") {
49 print "not ok 3 ($x @_)\n";
55 @val1 = @ENV{keys(%ENV)}; # can we slice ENV?
57 ok 5, join(':',@val1) eq join(':',@val2);
61 'foobarbaz' =~ /b(a)r/;
62 ok 7, $` eq 'foo', $`;
63 ok 8, $& eq 'bar', $&;
64 ok 9, $' eq 'baz', $';
69 ok 11, "@a" eq "foo bar baz", "@a";
72 ok 12, "@a" eq "foo,bar,baz", "@a";
78 ok 13, (keys %h)[0] eq "foo\034bar", (keys %h)[0];
83 ok 14, (keys %h)[0] eq 'fooxbar', (keys %h)[0];
93 ok 17, $@ eq "foo\n", $@;
98 if ($^O eq 'qnx' || $^O eq 'amigaos') {
104 $script = "$wd/show-shebang";
105 $s1 = $s2 = "\$^X is $wd/perl, \$0 is $script\n";
107 # Started by ksh, which adds suffixes '.exe' and '.' to perl and script
108 $s2 = "\$^X is $wd/perl.exe, \$0 is $script.\n";
110 ok 19, open(SCRIPT, ">$script"), $!;
111 ok 20, print(SCRIPT <<EOB . <<'EOF'), $!;
114 print "\$^X is $^X, \$0 is $0\n";
116 ok 21, close(SCRIPT), $!;
117 ok 22, chmod(0755, $script), $!;
119 s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
120 s{is perl}{is $wd/perl}; # for systems where $^X is only a basename
121 ok 23, $_ eq $s2, ":$_:!=:$s2:";
122 $_ = `$wd/perl $script`;
123 ok 24, $_ eq $s1, ":$_:!=:$s1: after `$wd/perl $script`";
124 ok 25, unlink($script), $!;
127 ok 26, $] >= 5.00319, $];
129 ok 28, $^T > 850000000, $^T;