Penguin
view release on metacpan or search on metacpan
Penguin/Compartment.pm view on Meta::CPAN
package Penguin::Compartment;
$VERSION = 3.00;
use Safe;
sub new {
my ($class, %args) = @_;
$self = { 'compartment' => new Safe,
'shares' => { },
'opset' => Safe::empty_opset,
};
bless $self, $class;
}
# if you share using 'register', then in the future,
# clients may be able to examine their own rights. Sharing
# using other methods might not permit them to do so.
sub register {
my ($self, %args) = @_;
my $share = $args{'Share'};
Penguin/Compartment.pm view on Meta::CPAN
my ($self, %args) = @_;
my ($share) = $args{'Share'};
undef $self->{'shares'}->{$share};
# reminder to myself: bother tim about unshare and clear_share.
1;
}
sub initialize {
my ($self, %args) = @_;
my $opstring = $args{'Operations'} || "";
$self->{'compartment'}->permit_only(Safe::ops_to_opset(split(/ +/, $opstring)));
1;
}
sub execute {
my ($self, %args) = @_;
$code = $args{'Code'};
$self->{'compartment'}->reval($code);
}
1;
( run in 1.740 second using v1.01-cache-2.11-cpan-71847e10f99 )