Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: How to get the name of an aliased function

by tlm (Prior)
on Aug 27, 2005 at 00:20 UTC ( [id://487069]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to get the name of an aliased function
in thread How to get the name of an aliased function

If I understand you right, the typical idiom to deal with the situation you describe is something like (untested):

package Foo; # ... my @fields = qw( eenie meenie minie moe ); make_accessor( $_ ) for @fields; # ... sub make_accessor { my $method = shift; my $sub = sub { # your accessor here; }; my $class = caller; { no strict 'refs'; *{ "$class\::$method" } = $sub; } return; }
...which does not require the methods to know their names.

the lowliest monk

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-25 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found