Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: what's a proper way to code method synonyms

by merlyn (Sage)
on Sep 06, 2006 at 23:05 UTC ( #571560=note: print w/replies, xml ) Need Help??


in reply to Re^2: what's a proper way to code method synonyms
in thread what's a proper way to code method synonyms

*{$new_method} = sub { my $self = shift; $self->$main_spelling(@_) }
Personally, I'd go with;
*{$new_method} = sub { goto &{$_[0]->can($main_spelling)} }
so that caller() would still work right.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2020-10-27 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (256 votes). Check out past polls.

    Notices?