Safe-Hole

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

PL_body_arenas|5.009004||Viu
PL_body_roots|5.009003||Viu
PL_bodytarget|5.005000||Viu
PL_breakable_sub_gen|5.010001||Viu
PL_bufend||5.003007|ponu
PL_bufptr||5.003007|ponu
PL_CCC_non0_non230|5.029008||Viu
PL_check|5.009003|5.006000|
PL_checkav|5.006000||Viu
PL_checkav_save|5.008001||Viu
PL_chopset|5.005000||Viu
PL_clocktick|5.008001||Viu
PL_collation_ix|5.005000||Viu
PL_collation_name|5.005000||Viu
PL_collation_standard|5.005000||Viu
PL_collxfrm_base|5.005000||Viu
PL_collxfrm_mult|5.005000||Viu
PL_colors|5.005000||Viu
PL_colorset|5.005000||Viu
PL_compcv|5.005000||Viu
PL_compiling|5.005000|5.003007|poVnu

t/01-hole.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More tests => 41;

use_ok('Safe::Hole');
use Safe;
use Opcode qw( opmask_add opset );

# Test construction
my $safe = Safe->new;
isa_ok( $safe, 'Safe' );

my $hole = Safe::Hole->new( {} );
isa_ok( $hole, 'Safe::Hole' );

# Test visibility of root namespace
our $v;

t/01-hole.t  view on Meta::CPAN


# Check Safe::Hole clears the opmask
$hole->wrap( \&do_op, $safe, '&do_op_wrapped' );
ok( !$safe->reval('do_op_wrapped()'), q{Check Safe::Hole clears the opmask} );

# Reality: check eof allowed
$op = 'eof';
ok( $safe->reval('do_op()'), 'Reality: check eof allowed' );

# Disable one opcode
opmask_add( opset('eof') );

# Make sure that opmask is restored
$hole->call( sub { } );

# Disabled opcode propagates into Safe compartment
ok( $safe->reval('do_op()'), 'Disabled opcode propagates into Safe compartment' );

# Disabled opcode is not disabled via $hole
ok( !$hole->call( \&do_op ), 'Disabled opcode is not disabled via $hole' );



( run in 1.277 second using v1.01-cache-2.11-cpan-71847e10f99 )