diff options
author | Abigail <abigail@abigail.be> | 2010-02-22 15:36:50 +0100 |
---|---|---|
committer | Abigail <abigail@abigail.be> | 2010-02-22 15:39:25 +0100 |
commit | 915f085e266692925ab67192c748f693c8c96c34 (patch) | |
tree | 0670be6c6b9450f22e73a7f400cf04ddf6b11d0c /lib | |
parent | a377de858ae4fe06ec59dc5f7e6abaa09db07f96 (diff) | |
download | perl-915f085e266692925ab67192c748f693c8c96c34.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Tie/Scalar.t | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Tie/Scalar.t b/lib/Tie/Scalar.t index fb33ca13cb..a8e803d1f5 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. |