Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Creating Nested Functions

by ikegami (Pope)
on Jul 10, 2008 at 07:46 UTC ( #696633=note: print w/ replies, xml ) Need Help??


in reply to Creating Nested Functions

I was asked about the possibility of using our $inner; instead of my $inner;. It's doable.

sub outer { ... local our $helper; $helper = sub { ... $helper->(...); ... }; $helper->(@_); }

local still needs to be used to protect the current value of the variable and to clear the reference to the helper sub when outer exits.

I don't see any advantage in localizing $helper instead of &helper.


Comment on Re: Creating Nested Functions
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2015-07-31 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls