[tpm] private method call nuances

Madison Kelly linux at alteeve.com
Mon Jul 20 21:56:41 PDT 2009


Uri Guttman wrote:
>>>>>> "MK" == Madison Kelly <linux at alteeve.com> writes:
> 
>   MK> Can you explain, or point me somewhere to better understand, how
>   MK> inheritance breaks using the '&' method? Also, I was a little
>   MK> unclear... if you pass in '$self', does that restore the inheritance?
>   MK> I just want to be clear so that I can best explain it in my paper.
> 
> & doesn't break inheritance, just calling the method as a sub breaks
> it. only $obj->method or CLASS->method are proper OO calls that will use
> inheritance. (yes, i skipped indirect method calls for good reason). on
> top of the lack of inheritance, &sub calls are nasty in another way. if
> you don't pass in args to them, they call the sub with the existing
> @_ which can be a nasty surprise as you might have expected the sub to
> be called with no args. so you are doing two wrong things by calling a
> method with &method( $self ).
> 
> the perl docs explain all of this so refer to them as usual.
> 
> uri

Indeed, and I have been referencing them, but I wasn't able to find an 
entry on the topic. Wasn't sure what to search for.

Thanks.

Madi


More information about the toronto-pm mailing list