Safe::Hole is a Perl module to make a hole to the original main compartment in the Safe compartment.
SYNOPSIS
use Safe;
use Safe::Hole;
$cpt = new Safe;
$hole = new Safe::Hole {};
sub test { Test->test; }
$Testobj = new Test;
# $cpt->share('&test'); # alternate as next line
$hole->wrap(&test, $cpt, '&test');
# ${$cpt->varglob('Testobj')} = $Testobj; # alternate as next line
$hole->wrap($Testobj, $cpt, '$Testobj');
$cpt->reval('test; $Testobj->test;');
print $@ if $@;
package Test;
sub new { bless {},shift(); }
sub test { my $self = shift; $self->test2; }
sub test2 { print "Test->test2 calledn"; }
We can call outside defined subroutines from the Safe compartment
using share(), or can call methods through the object that is copied
into the Safe compartment using varglob(). But that subroutines or
methods are executed in the Safe compartment too, so they cannot call
another subroutines that are dinamically qualified with the package
name such as class methods nor can they compile code that uses opcodes
that are forbidden within the compartment.
Through Safe::Hole, we can execute outside defined subroutines in the
original main compartment from the Safe compartment.
Note that if a subroutine called through Safe::Hole::call does a
Carp::croak() it will report the error as having occured within
Safe::Hole. This can be avoided by including Safe::Hole::User in the
@ISA for the package containing the subroutine.
Product's homepage
Requirements:
· Perl