ced has asked for the wisdom of the Perl Monks concerning the following question:
In Parent we have an AUTOLOAD method catching setters and getters for example.
If we have a Parent::Child::Granchild::AUTOLOAD method,
it will catch the non defined methods for Parent::Child::Granchild objects. If nothing is done in the lower AUTOLOAD howto get the upper one to try before giving up.
I tried in Parent::Child::Granchild
sub AUTOLOAD {
my $self=shift;
.....
if (we should do something here){
we do it;
return something;
}
else {
return $class->SUPER::AUTOLOAD();
}
This works but we loose the CONTENT of $AUTOLOAD coming in
Parent::AUTOLOAD.
Im'not very satisfied with this solution.
Is there some nicer way to do this and let Perl do the search for AUTOLOADS upwards?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: More then one AUTOLOAD in a class hierarchy.
by chromatic (Archbishop) on Nov 11, 2004 at 18:08 UTC | |
by ced (Initiate) on Nov 11, 2004 at 19:09 UTC | |
|
Re: More then one AUTOLOAD in a class hierarchy.
by stvn (Monsignor) on Nov 11, 2004 at 18:28 UTC | |
by ced (Initiate) on Nov 11, 2004 at 19:18 UTC | |
by stvn (Monsignor) on Nov 11, 2004 at 22:57 UTC | |
|
Re: More then one AUTOLOAD in a class hierarchy.
by tilly (Archbishop) on Nov 12, 2004 at 00:05 UTC | |
|
Re: More then one AUTOLOAD in a class hierarchy.
by gaal (Parson) on Nov 11, 2004 at 20:15 UTC | |
by ced (Initiate) on Nov 11, 2004 at 20:25 UTC |