Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by merlyn (Sage)
on Sep 06, 2006 at 23:05 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://571560]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found