Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Importing dynamic variables

by gellyfish (Monsignor)
on Nov 17, 2006 at 10:24 UTC ( #584697=note: print w/replies, xml ) Need Help??

in reply to Importing dynamic variables

Firstly you will need to have all of that in a BEGIN block in order for @EXPORT_OK to have the values in it when import is called by the use gen_var.

Also I would eschew the second eval and simply do something likeL

BEGIN { foreach my $variable (@variables) { eval "our \$$variable = $counter; push \@exported_symbols, \ +$$variable"; $counter++; push @EXPORT_OK, "\$$variable"; } }
I do something similar in Sys::Utmp for what it's worth. Actually it's worse because there I export the symbols into one module that then exports them to the callers namespace :-O


Replies are listed 'Best First'.
Re^2: Importing dynamic variables
by Anonymous Monk on Nov 18, 2006 at 22:21 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://584697]
[james28909]: is there some setting i am missing?
[GrandFather]: It's either lines that your browser won't split (no white space) or nodes with <pre> tags which ought to be code tags
[GrandFather]: I haven't noticed the problem for a while, but it can be hard to find the nasty node. If you do find it, consider it and with luck a janitor will fix it

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-05-24 00:56 GMT
Find Nodes?
    Voting Booth?