summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-12 17:50:51 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-07-12 17:50:51 -0700
commit986d39eeb4080ac83a841368252abaf063cc1486 (patch)
tree256ccc5ac4c43c9338bc2b6c5492dff548362d05
parentdfedf89255b7306231f87f711321b2a976aec65f (diff)
downloadperl-986d39eeb4080ac83a841368252abaf063cc1486.tar.gz
Fix @{*ISA} autovivification
It was not attaching magic to the array, preventing subsequent changes to the array from updating isa caches.
-rw-r--r--gv.c3
-rw-r--r--t/mro/basic.t9
2 files changed, 11 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index ba8e85ef1f..e0fdc630e9 100644
--- a/gv.c
+++ b/gv.c
@@ -83,6 +83,9 @@ Perl_gv_add_by_type(pTHX_ GV *gv, svtype type)
if (!*where)
*where = newSV_type(type);
+ if (type == SVt_PVAV && GvNAMELEN(gv) == 3
+ && strnEQ(GvNAME(gv), "ISA", 3))
+ sv_magic(*where, (SV *)gv, PERL_MAGIC_isa, NULL, 0);
return gv;
}
diff --git a/t/mro/basic.t b/t/mro/basic.t
index e1a4dbfddb..188159e2fc 100644
--- a/t/mro/basic.t
+++ b/t/mro/basic.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-BEGIN { require q(./test.pl); } plan(tests => 53);
+BEGIN { require q(./test.pl); } plan(tests => 54);
require mro;
@@ -338,3 +338,10 @@ is(eval { MRO_N->testfunc() }, 123);
ok !Gwythaint->isa("Fantastic::Creature"),
'obliterating @ISA via glob assignment';
}
+
+{
+ # Autovivifying @ISA via @{*ISA}
+ undef *fednu::ISA;
+ @{*fednu::ISA} = "pyfg";
+ ok +fednu->isa("pyfg"), 'autovivifying @ISA via *{@ISA}';
+}