Skip to content

Commit 2115f7f

Browse files
committed
Add sig-warn-obj: $SIG{__WARN__} handler gets non-stringified object
1 parent 4a0f7a6 commit 2115f7f

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

lib/Syntax/Construct.pm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ my %introduces = do { no warnings 'qw';
5959
'5.014' => [qw[
6060
?^ /r /d /l /u /a auto-deref
6161
^GLOBAL_PHASE \o package-block
62-
srand-return prototype+
62+
srand-return prototype+ sig-warn-obj
6363
]],
6464
'5.012' => [qw[
6565
package-version ... each-array
@@ -638,6 +638,10 @@ See B<srand() now returns the seed> under L<perl5140delta/Other Enhancements>.
638638
639639
See L<perl5140delta/Single-term-prototype>.
640640
641+
=head3 sig-warn-obj
642+
643+
See the second bullet in L<perl5140delta/Exception Handling>.
644+
641645
=head2 5.016
642646
643647
=head3 charnames

t/02-constructs.t

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ my %tests = (
269269
[ 'prototype+',
270270
'sub proto_plus (+) { $_[0][0] }; my @ar = qw( a b ); proto_plus(@ar)',
271271
'a' ],
272+
[ 'sig-warn-obj',
273+
'my $out;
274+
my $w = bless {}, "My::Warn";
275+
local $SIG{__WARN__} = sub { $out = $w };
276+
warn $w;
277+
$out->isa("My::Warn")',
278+
1
279+
],
272280
],
273281

274282
'5.012' => [

t/05-functions.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use FindBin;
66

77
my %count;
88
BEGIN {
9-
%count = (constructs => 102, old => 4, removed => 7);
9+
%count = (constructs => 103, old => 4, removed => 7);
1010
}
1111

1212
use Test::More tests => 5;

xt/completness.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use FindBin;
55

66
my $plan;
77
BEGIN {
8-
my %count = (constructs => 102,
8+
my %count = (constructs => 103,
99
removed => 7,
1010
aliases => 80,
1111
old => 4);

0 commit comments

Comments
 (0)