summaryrefslogtreecommitdiff
path: root/lib/Tie
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Tie')
-rw-r--r--lib/Tie/Scalar.t21
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.