Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://696633]
help
Chatterbox?
[Corion]: I heard a good analogy to the GDPR, which likely only works for Germans. GDPR is the new "separating your thrash", which is common in Germany. I equate "sharing" data with littering - and likely the fight will also take 30+ years for data sharing to ...
[Corion]: ... become as socially inacceptable as littering is today
[Corion]: Has anybody worked with Template::Liquid and Template::Liquid:: Include? I must be doing something stupid because Template::Liquid:: Include won't interpolate variables in the include files for me...
[Corion]: Template::LiquidX ::Include I meant...
[Corion]: Doh - 3rd time's the charm, maybe? Tempalte::LiquidX ::Tag::Include :D
[Corion]: Ah well, you know what it should be ;) hard, copied link

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2018-05-25 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?