Subject: | [PATCH] Honor readonly @ISA |
Default since cperl-5.26
A read-write @ISA makes no sense really.
--
Reini Urban
Subject: | 0001-honor-protected-ISA-default-since-cperl-5.26.patch |
From fb946231d747cadfb87966b80bb24ca6d8e71a0f Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpan.org>
Date: Mon, 6 Mar 2017 17:30:30 +0100
Subject: [PATCH] honor protected @ISA, default since cperl-5.26
A read-write @ISA makes no sense really.
Honor readonly @ISA's
---
lib/Class/C3/Componentised.pm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git lib/Class/C3/Componentised.pm lib/Class/C3/Componentised.pm
index 13173cb..43aa14e 100644
--- lib/Class/C3/Componentised.pm
+++ lib/Class/C3/Componentised.pm
@@ -196,7 +196,13 @@ sub inject_base {
for my $comp (reverse @_) {
my $apply = do {
no strict 'refs';
- sub { unshift ( @{"${target}::ISA"}, $comp ) };
+ sub {
+ my $ro = Internals::SvREADONLY(@{"${target}::ISA"});
+ Internals::SvREADONLY(@{"${target}::ISA"}, 0) if $ro;
+ my @ret = unshift ( @{"${target}::ISA"}, $comp );
+ Internals::SvREADONLY(@{"${target}::ISA"}, 1) if $ro;
+ @ret
+ };
};
unless ($target eq $comp || $target->isa($comp)) {
our %APPLICATOR_FOR;
--
2.11.1