Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Hiding, but maintaining variables in user-defined code

by gumpu (Friar)
on May 23, 2001 at 10:00 UTC ( #82478=note: print w/replies, xml ) Need Help??


in reply to Hiding, but maintaining variables in user-defined code

Your example is a bit confusing to me. You call $test->helper() with the same $test as $test->execute. In that case is $self in helper not equal to $self in execute?

Or do you mean that you want to call:

$test->execute( sub { print "in the local coderef\n"; helper(); } );

with

sub helper { print "in helper\n"; }

and still have access to $self in helper?

Have Fun

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-11-26 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?