|
|
b8876f |
From ab3bb20383d6dbf9baa811d06414ee474bb8f91e Mon Sep 17 00:00:00 2001
|
|
|
b8876f |
From: Father Chrysostomos <sprout@cpan.org>
|
|
|
b8876f |
Date: Wed, 1 Nov 2017 13:11:27 -0700
|
|
|
b8876f |
Subject: [PATCH] =?UTF-8?q?Carp:=20Don=E2=80=99t=20choke=20on=20ISA=20cons?=
|
|
|
b8876f |
=?UTF-8?q?tant?=
|
|
|
b8876f |
MIME-Version: 1.0
|
|
|
b8876f |
Content-Type: text/plain; charset=UTF-8
|
|
|
b8876f |
Content-Transfer-Encoding: 8bit
|
|
|
b8876f |
|
|
|
b8876f |
This broke some time between 1.29 (perl 5.18) and 1.3301 (perl 5.20):
|
|
|
b8876f |
|
|
|
b8876f |
$ perl5.20.1 -e 'package Foo { use constant ISA => 42; Bar::f() } package Bar { use Carp; sub f { carp "tun syn" } }'
|
|
|
b8876f |
Not a GLOB reference at /usr/local/lib/perl5/5.20.1/Carp.pm line 560.
|
|
|
b8876f |
|
|
|
b8876f |
and still persisted in bleadperl (Carp 1.43) until this commit.
|
|
|
b8876f |
|
|
|
b8876f |
The code that goes poking through the symbol table needs to take into
|
|
|
b8876f |
account that not all stash elements are globs.
|
|
|
b8876f |
|
|
|
b8876f |
Petr Písař: Ported to 5.24.3.
|
|
|
b8876f |
|
|
|
b8876f |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
b8876f |
---
|
|
|
b8876f |
dist/Carp/lib/Carp.pm | 3 ++-
|
|
|
b8876f |
dist/Carp/t/Carp.t | 13 ++++++++++++-
|
|
|
b8876f |
2 files changed, 14 insertions(+), 2 deletions(-)
|
|
|
b8876f |
|
|
|
b8876f |
diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
|
|
|
b8876f |
index 92f8866..f94b9d4 100644
|
|
|
b8876f |
--- a/dist/Carp/lib/Carp.pm
|
|
|
b8876f |
+++ b/dist/Carp/lib/Carp.pm
|
|
|
b8876f |
@@ -594,7 +594,8 @@ sub trusts_directly {
|
|
|
b8876f |
for my $var (qw/ CARP_NOT ISA /) {
|
|
|
b8876f |
# Don't try using the variable until we know it exists,
|
|
|
b8876f |
# to avoid polluting the caller's namespace.
|
|
|
b8876f |
- if ( $stash->{$var} && *{$stash->{$var}}{ARRAY} && @{$stash->{$var}} ) {
|
|
|
b8876f |
+ if ( $stash->{$var} && ref \$stash->{$var} eq 'GLOB'
|
|
|
b8876f |
+ && *{$stash->{$var}}{ARRAY} && @{$stash->{$var}} ) {
|
|
|
b8876f |
return @{$stash->{$var}}
|
|
|
b8876f |
}
|
|
|
b8876f |
}
|
|
|
b8876f |
diff --git a/dist/Carp/t/Carp.t b/dist/Carp/t/Carp.t
|
|
|
b8876f |
index 9ecdf88..f981005 100644
|
|
|
b8876f |
--- a/dist/Carp/t/Carp.t
|
|
|
b8876f |
+++ b/dist/Carp/t/Carp.t
|
|
|
b8876f |
@@ -3,7 +3,7 @@ no warnings "once";
|
|
|
b8876f |
use Config;
|
|
|
b8876f |
|
|
|
b8876f |
use IPC::Open3 1.0103 qw(open3);
|
|
|
b8876f |
-use Test::More tests => 66;
|
|
|
b8876f |
+use Test::More tests => 67;
|
|
|
b8876f |
|
|
|
b8876f |
sub runperl {
|
|
|
b8876f |
my(%args) = @_;
|
|
|
b8876f |
@@ -478,6 +478,17 @@ SKIP:
|
|
|
b8876f |
);
|
|
|
b8876f |
}
|
|
|
b8876f |
|
|
|
b8876f |
+{
|
|
|
b8876f |
+ package Mpar;
|
|
|
b8876f |
+ sub f { Carp::croak "tun syn" }
|
|
|
b8876f |
+
|
|
|
b8876f |
+ package Phou;
|
|
|
b8876f |
+ $Phou::{ISA} = \42;
|
|
|
b8876f |
+ eval { Mpar::f };
|
|
|
b8876f |
+}
|
|
|
b8876f |
+like $@, qr/tun syn/, 'Carp can handle non-glob ISA stash elems';
|
|
|
b8876f |
+
|
|
|
b8876f |
+
|
|
|
b8876f |
# New tests go here
|
|
|
b8876f |
|
|
|
b8876f |
# line 1 "XA"
|
|
|
b8876f |
--
|
|
|
b8876f |
2.13.6
|
|
|
b8876f |
|