Acme-Perl-VM

 view release on metacpan or  search on metacpan

inc/Module/Install.pm  view on Meta::CPAN

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
        );
}
 
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

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!perl -w
 
use strict;
use Test::More tests => 24;
 
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.371 second using v1.01-cache-2.11-cpan-95122f20152 )