From: Jerry D. Hedden Date: Fri, 7 Aug 2009 09:28:15 +0000 (+0200) Subject: t/safeuniversal.t failure under 5.8.9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4808f6259adb59f72021e7dad518fddbf365b71;p=p5sagit%2Fp5-mst-13.2.git t/safeuniversal.t failure under 5.8.9 [RT CPAN #48505] The "no warnings 'redefined'" directives in the compartments in t/safeuniversal.t cause test failures under 5.8.9 because warnings.pm has a 'use Carp' directive and Carp.pm uses 'eval' to 'require Carp::Heavy'. The attached patch replaces the "no warnings 'redefined'" directive with a $SIG{__WARN__} trap for 5.8.9. While the redefine warning for UNIVERSAL::can is suppressed by the trap, the warning UNIVERSAL::isa still shows up. However, the failing test will now pass under 5.8.9. --- diff --git a/ext/Safe/t/safeuniversal.t b/ext/Safe/t/safeuniversal.t index 5ef3842..c6d9911 100644 --- a/ext/Safe/t/safeuniversal.t +++ b/ext/Safe/t/safeuniversal.t @@ -22,8 +22,10 @@ plan(tests => 6); my $c = new Safe; $c->permit(qw(require caller)); -my $r = $c->reval(q! - no warnings 'redefine'; +my $no_warn_redef = ($] != 5.008009) + ? q(no warnings 'redefine';) + : q($SIG{__WARN__}=sub{};); +my $r = $c->reval($no_warn_redef . q! sub UNIVERSAL::isa { "pwned" } (bless[],"Foo")->isa("Foo"); !); @@ -33,8 +35,7 @@ is( (bless[],"Foo")->isa("Foo"), 1, "... but not outside" ); sub Foo::foo {} -$r = $c->reval(q! - no warnings 'redefine'; +$r = $c->reval($no_warn_redef . q! sub UNIVERSAL::can { "pwned" } (bless[],"Foo")->can("foo"); !);