Acme-Perl-VM
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
187188189190191192193194195196197198199200201202203204205206207
);
}
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
188189190191192193194195196197198199200201202203204205206207208209210211
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
123456789101112131415161718192021222324252627282930313233343536373839404142#!perl -w
use
strict;
use
Acme::Perl::VM;
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 )