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

Re^2: Making variables visible between calls.

by ambs (Pilgrim)
on Dec 12, 2008 at 18:11 UTC ( #730003=note: print w/replies, xml ) Need Help??


in reply to Re: Making variables visible between calls.
in thread Making variables visible between calls.

That doesn't help. I need to let the user define his own function, and give him the possibility to access some pre-defined variables in case he wish to.

My only possibility at the moment is to force the user defined function to receive a set of predefined parameters. But that will mess up some things later...

But thanks, anyway ;)

Alberto Simões

  • Comment on Re^2: Making variables visible between calls.

Replies are listed 'Best First'.
Re^3: Making variables visible between calls.
by eric256 (Parson) on Dec 12, 2008 at 20:13 UTC

    It sounds like you realy want to pass it a hash. Then just preload the hash with values that it should have access to.

    my $function = sub {my $v = shift; print ">> $v->{var} <<\n" }; my $params = {var => 'exto'}; $function->($params);

    ___________
    Eric Hodges

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2020-10-25 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?