develooper Front page | perl.perl5.porters | Postings from March 2016

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

Thread Previous
From:
Dave Mitchell
Date:
March 25, 2016 09:23
Subject:
Re: [perl #123585] *ISA glob assignment may break inheritance cache
Message ID:
20160325092257.GD29332@iabyn.com
On Sun, Jan 11, 2015 at 08:19:33AM -0800, Sergey Aleynikov wrote:
> # 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.

The first one was fixed by this:

    commit 8452c1a03e174c7b4f513b81f58ac142e290df36
    Author: Tony Cook <tony@develop-help.com>
    Date:   Tue Jan 26 15:53:34 2016 +1100

    [perl #127351] add isaelem magic on *Foo::ISA = arrayref

The second one still fails in blead.

-- 
The Enterprise is captured by a vastly superior alien intelligence which
does not put them on trial.
    -- Things That Never Happen in "Star Trek" #10

Thread Previous


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