David Garamond wrote:

> i'm looking for something like a sandbox/compartment (like rexec module
> in python) so that i can be [reasonably] confident running untrusted
> snippets of code from inside the same process.
> 
> Safe.pm seems like the perl way of doing it, right? however, from what i
> skimmed from the posts i got from google, Safe.pm is considered to be
> too broken to use.
> 
> anyone care to explain why Safe.pm is too broken, or if it can be used
> at all, some examples or projects where it is being used?
> 

i won't say it's broken, it's just that the Safe.pm is not finalized yet and 
thus will undergo(probably) major changes even in the interface level. 
example:

#!/usr/bin/perl -w
use strict;

my $s = new Safe;

#-- the following will print unable to execute system()
print "first attemp:\n";
if($s->reval('system("ls -l")')){
        print "unable to execute system()\n";
}else{
        print "system() executed\n";
}

#-- add system() for safety
$s->permit(qw(system));

#-- the following will works
print "second attemp:\n";
if($s->reval('system("ls -l")')){
        print "unable to execute system()\n";
}else{
        print "system() executed\n";
}

__END__

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to