Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^5: private recursive subroutines

by ph713 (Pilgrim)
on May 14, 2007 at 00:14 UTC ( [id://615204]=note: print w/replies, xml ) Need Help??


in reply to Re^4: private recursive subroutines
in thread private recursive subroutines

Yes, in perl-current with my mro.c stuff (and eventually 5.10), when you change the @ISA of a class or change a method in a class, it only invalidates the method cache of that specific class, as well as any classes which inherit from that class (as opposed to the behavior in 5.9.4 and earlier, where changing a method or @ISA anywhere invalidated all method caches globally).

Also, while in 5.9.4 and earlier the recursive lookup via @ISA is performed every time an uncached method call was made, with the new mro stuff the recursive @ISA parent hierarchy of a class is linearized into a simple flat list of classes to search with no duplicates, and cached. That "linearized isa" cache is only blown on @ISA changes in the given class or its parents, not method changes. So even when you (locally) invalidate the method caches by redefining a subroutine, these @ISA linearizations stay in place, making that first lookup to refill the cache faster than it was before.

Replies are listed 'Best First'.
Re^6: private recursive subroutines
by demerphq (Chancellor) on May 14, 2007 at 08:36 UTC

    Im just curious as to whether there will be any way from perl code to see the linearized array. I could see that being useful indeed. Maybe @^ISA could provide read access to this data.

    ---
    $world=~s/war/peace/g

      Yes, via mro::get_linear_isa('Foo'). This and other related calls are docced in bleadperl's "perldoc mro". There's also MRO::Compat on CPAN, so you can start using those interfaces today and be forward/backward compat between 5.6/5.8/5.10.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://615204]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-20 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found