in reply to Re^2: How to use Safe to compile anonymous subs
in thread How to use Safe to compile anonymous subs
my $code = 'sub { my $arg = shift; warn $arg; }';
Update: Since the above looks alot like your original post, here is more.
I've never used Safe but my doc's indicate that you need a namespace as the first arg to Safe->new.
use Safe; my $code = 'sub { my $arg = shift; warn $arg; }'; my $safe = Safe->new(); my $ssub = $safe->reval( $code) || die ; $ssub->( "hello$/" ); &$ssub( "hello$/" );
Be well,
rir
|
|---|