develooper Front page | perl.perl5.porters | Postings from January 2015

[perl #123585] *ISA glob assignment may break inheritance cache

Thread Next
From:
Sergey Aleynikov
Date:
January 11, 2015 16:19
Subject:
[perl #123585] *ISA glob assignment may break inheritance cache
Message ID:
rt-4.0.18-7978-1420993173-650.123585-75-0@perl.org
# New Ticket Created by  Sergey Aleynikov 
# Please include the string:  [perl #123585]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123585 >


The following two snippets result in 'Can't locate object method "foo" via package "G"' error, though they must succeed instead:

*F::foo = sub {};
*G::ISA = ['H'];
$G::ISA[0] = 'F';
G->foo;

===========

*F::foo = sub {};
*G::ISA = ['H'];
*G::foo = ['H'];
*G::ISA = *G::foo;
$G::ISA[0] = 'F';
G->foo;


The reason for this is that in glob_assign_glob and gv_setref only PERL_MAGIC_isa magic is assigned to the AV slot, but nothing to it's content. And PERL_MAGIC_isa -> PERL_MAGIC_isaelem propagation occurs only upon array write access, and not for individual elements' r/w access.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About