in reply to limiting scope of 'eval'??
package Foo; $Foo::var1 = 'VAR_A'; my $pkg = '_eval_'; $Foo::var2 = <<"__END_EVAL__"; package $pkg; print "VAR_B( \$${pkg}::var1 )\\n"; __END_EVAL__ eval $Foo::var2;
In other words, you could, but it would be very messy and would require you to code in a completely odd style. The issue you're running into is that eval'ed code is compiled and executed within the context that the eval() call has.
More importantly - why are you wanting to do this? There most likely is a better way to do what you're trying to do ...
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
|
|---|