http://www.perlmonks.org?node_id=730003


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