in reply to limiting scope of 'eval'??
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: limiting scope of 'eval'??
by Crackers2 (Parson) on Aug 22, 2004 at 14:03 UTC | |
|
Re^2: limiting scope of 'eval'??
by Anonymous Monk on Aug 23, 2004 at 15:14 UTC |