Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: subroutine refs

by fenLisesi (Priest)
on Nov 30, 2007 at 13:15 UTC ( #654098=note: print w/ replies, xml ) Need Help??


in reply to subroutine refs

It is likely that the application can (and perhaps should) be rearchitected, but let's not go there. In addition to the suggestions above, one quirky way would be to use OO syntax, but that would add an argument to all your sub definitions. For example:

use strict; use warnings; my $meth_name = 'foo'; __PACKAGE__->$meth_name('camel'); exit( 0 ); sub foo { my ($self, $arg) = @_; print "$arg (on behalf of $self)\n"; }

which prints

camel (on behalf of main)


Comment on Re: subroutine refs
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2014-10-31 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (217 votes), past polls