Dave Mitchell wrote > Okay, here's a patch. When Safe code is eval'ed now, there are no > lexical variables declared within any nested scope, apart from one called > $__ExPr__, which is actually local to the code being evaled and has no > connection with a lexical variable of the same name that happens to be in > an outer nested scope and which is used by Safe.pm. No need for an extra lexical - you've got the eval() and the sub {} the wrong way out. > So Safe.pm used to do the rough equivalent of > > sub reval { > my $expr = (code to be evaled); > safe_call_sv(sub { eval $expr }); > ); That should be written sub reval { safe_call_sv(eval 'sub {' . shift() . '}'); }; (with of course error checking etc). Indeed, you only need do the eval() in the subroutine at the top of the code - the safe_call_cv() can be done anywhere you like. Mike Guy