Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 perusing the Monastery: (6)
As of 2020-07-10 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?