in reply to Re^2: Eval doesn't see lexicals
in thread Eval doesn't see lexicals
Meanwhile, in a nearby perl script ...package EvilEval; use Class::Std; sub _serial() { '1234567890' }; my %serial_of :ATTR; sub BUILD { my ( $this, $ident, $arg_ref ) = @_; $serial_of{$ident} = _serial(); } sub evil { #use Data::Dumper; print Dumper \%serial_of; my $string = 'use Data::Dumper; print Dumper \%serial_of'; eval $string; } 1;
This demonstrates the problem, at least on my setup. If all the code is in the same file there is no problem - even if it is declared in different packages. When the caller is in a different file, the problem occurs.use EvilEval; my $evil = EvilEval->new(); $evil->evil();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Eval doesn't see lexicals
by tilly (Archbishop) on Nov 02, 2005 at 02:26 UTC |