Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: method aliases with goto(&NAME)

by ikegami (Pope)
on Sep 18, 2013 at 19:24 UTC ( #1054727=note: print w/ replies, xml ) Need Help??


in reply to method aliases with goto(&NAME)

What are your motivations?

Modify the stack to pretend `legacy_method` wasn't called is surely detrimental. You could avoid that (and speed things up an itsy bit) with the following:

sub legacy_method { &current_method; }

But both the above and your approach fail when a child class overrides current_method. I'd use the following:

sub legacy_method { my $self = shift; $self->current_method(@_); }

(Which actually works and avoids needless copying unlike the code you presented as the baseline.)


Comment on Re: method aliases with goto(&NAME)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-07-29 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls