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

Re: Invoking a string reference to a anonymous subroutine

by runrig (Abbot)
on Jan 14, 2014 at 19:17 UTC ( [id://1070589]=note: print w/replies, xml ) Need Help??


in reply to Invoking a string reference to a anonymous subroutine

You can do:Update: Ooops, no, you can't do this in your example since your subroutine does not have a name...
$self->$handler(@arguments);
Or use the code ref directly (saves a method lookup) (update: and you can do this):
$self->$_parse_element_configuration(@arguments);

Replies are listed 'Best First'.
Re^2: Invoking a string reference to a anonymous subroutine
by AnomalousMonk (Archbishop) on Jan 14, 2014 at 21:58 UTC
    You can do:

    $self->$handler(@arguments);

    This will only work if the anonymous subroutine reference is assigned to  $handle and not the name of the lexical as in the OP.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-24 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found