Acme-RPC
view release on metacpan or search on metacpan
lib/Acme/RPC.pm view on Meta::CPAN
my $scalarcontains = $$object;
if(ref($scalarcontains) and ref($scalarcontains) ne 'SCALAR') {
$node->{ref($scalarcontains)} = caller_cv(0)->($scalarcontains);
}
} elsif(ref($object) eq 'CODE') {
# generic name for ourself -- this was found inside another code ref, in instance data, array element, or something.
reg( $node->{chr(0)} = $object );
# variables inside code refs
# walk into the sub and pick out lexical variables
# normally only closures would contain data in their lexical variables, but with multiple
# coroutines executing concurrently, there's the chance that a subroutine is currently
# running, in which case it has data in its pad. if it's recursive, it might have data
# at multiple depths too!
my $p = peek_sub($object);
for my $k (sort { $a cmp $b } keys %$p) {
$node->{$k} = caller_cv(0)->($p->{$k}); # anything it contains by way of refs, which might be nothing
reg( $node->{$k}{chr(0)} = $p->{$k} ); # have to do this after assigning in from the recursie call
}
} elsif( ! ref($object) ) {
# XXX how could we represent constant data, as in the case of our $foo = "hi there", or instance data fields, or...?
}
( run in 0.229 second using v1.01-cache-2.11-cpan-87723dcf8b7 )