Acme-Perl-VM
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
);
}
my @exts = @{$self->{extensions}};
unless ( @exts ) {
@exts = $self->{admin}->load_all_extensions;
}
my %seen;
foreach my $obj ( @exts ) {
while (my ($method, $glob) = each %{ref($obj) . '::'}) {
next unless $obj->can($method);
next if $method =~ /^_/;
next if $method eq uc($method);
$seen{$method}++;
}
}
my $who = $self->_caller;
foreach my $name ( sort keys %seen ) {
*{"${who}::$name"} = sub {
lib/Acme/Perl/VM/Scope.pm view on Meta::CPAN
isa => 'Ref',
);
sub save_type;
sub create_ref;
sub sv;
sub BUILD{
my($self) = @_;
my $glob_ref = $self->gv->object_2svref;
$self->old_ref( *{$glob_ref}{ $self->save_type } );
*{$glob_ref} = $self->create_ref();
return;
}
sub leave{
my($self) = @_;
*{$self->gv->object_2svref} = $self->old_ref;
return;
}
t/10_rv2xv.t view on Meta::CPAN
#!perl -w
use strict;
use Test::More tests => 24;
use Acme::Perl::VM;
use Acme::Perl::VM qw(:perl_h);
use B qw(svref_2object);
our $x = 10;
sub inc_global{
our $x;
$x++;
return $x;
}
sub inc_local{
local $x;
$x++;
return $x;
}
is_deeply [run_block{ our $x = 10 }], [10];
is_deeply [run_block{ our @x = 20 }], [20];
is_deeply [run_block{ *STDIN }], [ *STDIN];
is_deeply [run_block{ \*STDIN }], [\*STDIN];
#is_deeply [run_block{ \&ok }];
is_deeply [inc_global()], [11];
is_deeply [inc_global()], [12];
is_deeply [inc_local()], [1];
is_deeply [inc_local()], [1];
$x = 10;
is scalar(run_block{
local $x = 100;
$x++;
return $x;
}), 101;
( run in 0.974 second using v1.01-cache-2.11-cpan-49f99fa48dc )