Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: goto superclass method

by ikegami (Pope)
on Dec 22, 2004 at 19:21 UTC ( #416873=note: print w/replies, xml ) Need Help??


in reply to Re: goto superclass method
in thread goto superclass method

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://416873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2019-06-26 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (110 votes). Check out past polls.

    Notices?