From: Abigail Date: Mon, 22 Feb 2010 14:36:50 +0000 (+0100) Subject: Bram pointed out the new tests hang if the fix for #72878 isn't in place. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=915f085e266692925ab67192c748f693c8c96c34;p=p5sagit%2Fp5-mst-13.2.git Bram pointed out the new tests hang if the fix for #72878 isn't in place. This commits traps the recursion and throws an exception. --- diff --git a/lib/Tie/Scalar.t b/lib/Tie/Scalar.t index fb33ca1..a8e803d 100644 --- a/lib/Tie/Scalar.t +++ b/lib/Tie/Scalar.t @@ -83,11 +83,22 @@ package main; @NoMethods::ISA = qw [Tie::Scalar]; -eval {tie my $foo => "NoMethods"}; - -like $@ => - qr /\QNoMethods must define either a TIESCALAR() or a new() method/, - "croaks if both new() and TIESCALAR() are missing"; +{ + # + # Without the fix for #72878, the code runs forever. + # Trap this, and die if with an appropriate message if this happens. + # + local $SIG {__WARN__} = sub { + die "Called NoMethods->new" + if $_ [0] =~ /^WARNING: calling NoMethods->new/; + }; + + eval {tie my $foo => "NoMethods";}; + + like $@ => + qr /\QNoMethods must define either a TIESCALAR() or a new() method/, + "croaks if both new() and TIESCALAR() are missing"; +}; # # Don't croak on missing new/TIESCALAR if you're inheriting one.