I just wanted to point out that I couldn't get any of the posted answers to work. Perhaps its a flaw in the way I implemented them so below is the code i tried and its output.
use strict; use warnings; my $test = q[print $a;]; my $a = "doesn't stop me\n"; sub eval_it { eval shift; } { package safezone; sub eval_it { eval shift; } } warn "regular eval"; eval $test; warn "eval_it"; eval_it $test; warn "safezone::eval_it"; safezone::eval_it $test; warn "Prepend package"; eval "package safezone; $test"; __DATA__ regular eval at eval.pl line 18. doesn't stop me eval_it at eval.pl line 21. doesn't stop me safezone::eval_it at eval.pl line 24. doesn't stop me Prepend package at eval.pl line 27. doesn't stop me
In reply to Re: limiting scope of 'eval'??
by eric256
in thread limiting scope of 'eval'??
by ManFromNeptune
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |