[tpm] private method call nuances

Michael Graham magog at the-wire.com
Mon Jul 20 20:17:24 PDT 2009


> Can you explain, or point me somewhere to better understand, how 
> inheritance breaks using the '&' method? Also, I was a little
> unclear... if you pass in '$self', does that restore the inheritance?
> I just want to be clear so that I can best explain it in my paper.

If you call: 
    
    foo($thingy);

you're calling the "foo" sub in the current package.

If you call:

    $thingy->foo;

you're saying:  

    - Find the package that $thingy is blessed into.
    - If there's a "foo" sub in that package, run it.  
      Otherwise, walk the inheritance tree of that package, and run the
      first "foo" sub found.



Michael


-- 
Michael Graham <magog at the-wire.com>


More information about the toronto-pm mailing list