#!./perl -w
$|=1;
BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
+ if($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
require Config; import Config;
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
print "1..0\n";
$cpt = new Safe "Root";
$cpt->reval(q{ system("echo not ok 1"); });
-if ($@ =~ /^system trapped by operation mask/) {
+if ($@ =~ /^'?system'? trapped by operation mask/) {
print "ok 1\n";
} else {
print "#$@" if $@;
# --- rdo
+my $t = 30;
+$! = 0;
my $nosuch = '/non/existant/file.name';
open(NOSUCH, $nosuch);
-my $errno = $! + 0;
+if ($@) {
+ my $errno = $!;
+ die "Eek! Attempting to open $nosuch failed, but \$! is still 0" unless $!;
+ $! = 0;
+ $cpt->rdo($nosuch);
+ print $! == $errno ? "ok $t\n" : sprintf "not ok $t # \"$!\" is %d (expected %d)\n", $!, $errno; $t++;
+} else {
+ die "Eek! Didn't expect $nosuch to be there.";
+}
close(NOSUCH);
-my $t = 30;
-$cpt->rdo($nosuch);
-print $! == $errno ? "ok $t\n" : sprintf "not ok $t # \"$!\" is %d (expected %d)\n", $!, $errno; $t++;
# test #31 is gone.
print "ok $t\n"; $t++;