Perl Monk, Perl Meditation | |
PerlMonks |
Re: Re: Weird inheritance and SUPERby roundboy (Sexton) |
on Jan 22, 2003 at 02:41 UTC ( [id://228924]=note: print w/replies, xml ) | Need Help?? |
Thanks, yes, the change you suggest do eliminate the error. But:
My problem, upon reflection, was that in trying to understand this, I read the following in my trusty Camel: SUPER...follows @ISA just as the regular inheritance mechanism does: in left-to-right, recursive, depth-first order. (3e, p. 325) However, I'd failed to read notice the following: A SUPER method consults the @ISA only of the package into which the call to SUPER was compiled. It does not care about the class of the invocant, nor about the package of the subroutine that was called. (ibid) I guess I expected that SUPER would follow the invocant's class hierarchy. As I mentioned in my original post, I solved the problem by renaming Q::bar, but now I'm curious. Is there a way to get the behavior I was looking for, without either changing method names or the class hierarchy? I imagine this would be some magic to replace the SUPER Thanks.
In Section
Seekers of Perl Wisdom
|
|