Re: safe-module and namespaces
- From: Charles DeRykus <ced@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 20:24:07 GMT
peter pilsl wrote:
I try to use the safe-module to evaluate user-provided code, but it seems there is a knot in my brain.
use Safe;
$s=new Safe "xxx";
$xxx::x=3;
$s->reval('$x=4');
print $xxx::x,"\n"
Well, this prints out 3 as result and I think it should be 4!
What am I not thinking of?
I don't know Safe well... ok, hardly at all.
But, I suspect package variables seen outside the safe
compartment are no longer accessible. I'm not sure how
the mechanism works to ensure that.
If 'xxx' is explicitly shared, the following does print '4'.
my $s = Safe->new( "xxx" );
$xxx::x=3;
$s->share_from('xxx', ['$x'] );
$s->reval('$x=4');
print $xxx::x;
--
Charles DeRykus
.
- References:
- safe-module and namespaces
- From: peter pilsl
- safe-module and namespaces
- Prev by Date: Re: Print out modules used during runtime?
- Next by Date: Re: Searching large files with a regex and a list
- Previous by thread: Re: safe-module and namespaces
- Next by thread: FAQ 4.32 How do I strip blank space from the beginning/end of a string?
- Index(es):
Relevant Pages
|
|