Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2025-06-16 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.