From 4737eb6d9f548f14a39c3572e8587326b34aa185 Mon Sep 17 00:00:00 2001 From: "E. Choroba" Date: Fri, 13 Jun 2025 19:35:39 +0200 Subject: [PATCH 1/2] Add sig-warn-obj: $SIG{__WARN__} handler gets non-stringified object --- lib/Syntax/Construct.pm | 6 +++++- t/02-constructs.t | 9 +++++++++ t/05-functions.t | 2 +- xt/completness.t | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/Syntax/Construct.pm b/lib/Syntax/Construct.pm index ee9d59c..31655a7 100644 --- a/lib/Syntax/Construct.pm +++ b/lib/Syntax/Construct.pm @@ -59,7 +59,7 @@ my %introduces = do { no warnings 'qw'; '5.014' => [qw[ ?^ /r /d /l /u /a auto-deref ^GLOBAL_PHASE \o package-block - srand-return prototype+ + srand-return prototype+ sig-warn-obj ]], '5.012' => [qw[ package-version ... each-array @@ -638,6 +638,10 @@ See B under L. See L. +=head3 sig-warn-obj + +See the second bullet in L. + =head2 5.016 =head3 charnames diff --git a/t/02-constructs.t b/t/02-constructs.t index d6ab16e..4812a27 100755 --- a/t/02-constructs.t +++ b/t/02-constructs.t @@ -269,6 +269,15 @@ my %tests = ( [ 'prototype+', 'sub proto_plus (+) { $_[0][0] }; my @ar = qw( a b ); proto_plus(@ar)', 'a' ], + [ 'sig-warn-obj', + 'sub My::Warn::value { 42 } + my $out; + my $w = bless {}, "My::Warn"; + local $SIG{__WARN__} = sub { $out = shift->value }; + warn $w; + $out', + 42 + ], ], '5.012' => [ diff --git a/t/05-functions.t b/t/05-functions.t index bc95640..27bd50c 100755 --- a/t/05-functions.t +++ b/t/05-functions.t @@ -6,7 +6,7 @@ use FindBin; my %count; BEGIN { - %count = (constructs => 102, old => 4, removed => 7); + %count = (constructs => 103, old => 4, removed => 7); } use Test::More tests => 5; diff --git a/xt/completness.t b/xt/completness.t index 4596061..681c91e 100755 --- a/xt/completness.t +++ b/xt/completness.t @@ -5,7 +5,7 @@ use FindBin; my $plan; BEGIN { - my %count = (constructs => 102, + my %count = (constructs => 103, removed => 7, aliases => 80, old => 4); From a433ef665498a12fe12a04ec12443b7dd750973c Mon Sep 17 00:00:00 2001 From: "E. Choroba" Date: Fri, 13 Jun 2025 20:04:23 +0200 Subject: [PATCH 2/2] Bump the version --- Changes | 3 +++ lib/Syntax/Construct.pm | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 2c89ae2..26bd70c 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Syntax-Construct +1.042 2025-06-13 + - Add sig-warn-obj + 1.041 2025-06-09 - Add the __FILE__() syntax diff --git a/lib/Syntax/Construct.pm b/lib/Syntax/Construct.pm index 31655a7..275114f 100644 --- a/lib/Syntax/Construct.pm +++ b/lib/Syntax/Construct.pm @@ -4,7 +4,7 @@ use 5.006002; use strict; use warnings; -our $VERSION = '1.041'; +our $VERSION = '1.042'; my %introduces = do { no warnings 'qw'; ( '5.040' => [qw[ @@ -305,7 +305,7 @@ Syntax::Construct - Explicitly state which non-feature constructs are used in th =head1 VERSION -Version 1.041 +Version 1.042 =head1 SYNOPSIS