tbutler has asked for the wisdom of the Perl Monks concerning the following question:
I've run into a problem that I'm not quite sure how to describe.
In essence, I think I'm looking for a SUPRA class -- sort of a reverse of SUPER. Here's what I am trying to do: I have a child class that only has a subset of the methods of its parent. So let's say method finalize is called. It ends up going to the parent class.
This is where things get tricky. finalize calls another one of the class's methods, finalize_body. And, while the parent class has a finalize_body, so does the child class. Assuming the child class has a finalize_body method, I would like to move back to the child class and not use the parent's method.
Yet, I haven't been able to think of a way to do this without explicitly naming the child package. Moreover, I'd like for it to be setup in such a way where if the child does not have a finalize_body class, it will move down the tree of inheritance normally and use the parent's method instead.
Does that make sense? Is there a simple way to do what I'm trying to do?
Thanks for your help!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Supra Class for Inheritance?
by ikegami (Patriarch) on Aug 21, 2010 at 00:59 UTC | |
by tbutler (Initiate) on Aug 21, 2010 at 02:51 UTC | |
Re: Supra Class for Inheritance?
by merlyn (Sage) on Aug 21, 2010 at 02:56 UTC | |
by ikegami (Patriarch) on Aug 21, 2010 at 03:27 UTC | |
Re: Supra Class for Inheritance?
by Anonymous Monk on Aug 21, 2010 at 00:47 UTC | |
by Anonymous Monk on Aug 21, 2010 at 02:49 UTC |