Here's an alternative that doesn't use a loop:
package MyModule; use vars qw(@ISA); BEGIN { @ISA = ...; *MyModule::Super::ISA = \@ISA; } sub dostuff { if (...condition...) { if (my $method = MyModule::Super->can('dostuff')) { goto $method; } ...die?... } ... }
You probably know that dostuff exists in a parent, you can simplify it down to:
package MyModule; use vars qw(@ISA); BEGIN { @ISA = ...; *MyModule::Super::ISA = \@ISA; } sub dostuff { goto(MyModule::Super->can('dostuff')) if (...condition...); ... }
Don't put any methods (or at least not 'dostuff') in the MyModule::Super package (namespace) for this to work.
In reply to Re^2: goto superclass method
by ikegami
in thread goto superclass method
by avarus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |