in reply to Safe.pm is broken - entertry fails

reval acts as eval does and can be used as a try with the added benefit of catching non-allowed ops. it sets $@ on a error just like the eval try. I do not understand what you are trying to do here? a nested eval try?


-Waswas

Replies are listed 'Best First'.
Re: Re: Safe.pm is broken - entertry fails
by dtreder (Novice) on Dec 18, 2003 at 20:32 UTC
    I'm using Safe to evaluate some untrusted code, basically to protect a developer from doing something stupid. One of the dumb things he might try to do is eval "", i.e. evaluating any input as perl code would not be smart. However I still want to let him catch exceptions, i.e. use eval {}.

    So my little sample code has reval(" eval {1}; "). Basically I want reval(' eval "code"; ') to fail and I want reval(' eval { 1 }; ') to succeed.