From: Artur Bergman Date: Sun, 6 Oct 2002 15:40:56 +0000 (+0000) Subject: Upgrade Safe.pm to 2.09 after CPAN backport. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ac5e36916bf9bff6ce2594ce0b6db3ecde427ff6;p=p5sagit%2Fp5-mst-13.2.git Upgrade Safe.pm to 2.09 after CPAN backport. Fix testcases to run properly outside perl core build enviroment. p4raw-id: //depot/perl@17980 --- diff --git a/ext/Opcode/Safe.pm b/ext/Opcode/Safe.pm index ad46bbb..b090e40 100644 --- a/ext/Opcode/Safe.pm +++ b/ext/Opcode/Safe.pm @@ -3,7 +3,7 @@ package Safe; use 5.003_11; use strict; -our $VERSION = "2.08"; +$Safe::VERSION = "2.09"; use Carp; @@ -47,7 +47,7 @@ sub new { # the whole glob *_ rather than $_ and @_ separately, otherwise # @_ in non default packages within the compartment don't work. $obj->share_from('main', $default_share); - Opcode::_safe_pkg_prep($obj->{Root}); + Opcode::_safe_pkg_prep($obj->{Root}) if($Opcode::VERSION > 1.04); return $obj; } diff --git a/ext/Safe/safe1.t b/ext/Safe/safe1.t index 27993d9..6a3b908 100755 --- a/ext/Safe/safe1.t +++ b/ext/Safe/safe1.t @@ -1,13 +1,16 @@ #!./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"; exit 0; } + } # Tests Todo: diff --git a/ext/Safe/safe2.t b/ext/Safe/safe2.t index 94398d4..3ea19ed 100755 --- a/ext/Safe/safe2.t +++ b/ext/Safe/safe2.t @@ -1,8 +1,10 @@ #!./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"; @@ -38,7 +40,7 @@ $cpt = new Safe or die; $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 $@; diff --git a/ext/Safe/safe3.t b/ext/Safe/safe3.t index 6265d14..2d5f275 100644 --- a/ext/Safe/safe3.t +++ b/ext/Safe/safe3.t @@ -4,14 +4,14 @@ BEGIN { if ($ENV{PERL_CORE}) { chdir 't' if -d 't'; @INC = '../lib'; - require Config; import Config; - if ($Config{'extensions'} !~ /\bOpcode\b/ - && $Config{'extensions'} !~ /\bPOSIX\b/ - && $Config{'osname'} ne 'VMS') - { - print "1..0\n"; - exit 0; - } + } + require Config; import Config; + if ($Config{'extensions'} !~ /\bOpcode\b/ + && $Config{'extensions'} !~ /\bPOSIX\b/ + && $Config{'osname'} ne 'VMS') + { + print "1..0\n"; + exit 0; } }