Acme-RPC
view release on metacpan or search on metacpan
lib/Acme/RPC.pm view on Meta::CPAN
Even if they're hidden away in objects referenced from inside of closures.
The RPC daemon starts after the program finishes, or whe it does C<< Event::loop >>.
=head2 CGI Parameters
=over 4
=item C<< / >>
(No parameter.)
=item C<< action=dump >>
Gives an index of packages, subroutines, variables in those subroutines, closures in those variables, and so on.
=item C<< output=json >>
Output a JavaScript datastructures (JSON) instead of Perl style L<Data::Dumper> or HTML.
The main index page otherwise prints out HTML (under the assumption that a human will be digging through it)
and other things mostly emit L<Data::Dumper> formatted text.
=item C<< oid=(number) >>
=item C<< path=/path/to/something >>
There are two ways to specify or reference an object: by it's C<oid> or by the path to navigate to it from the
main index screen.
JSON and HTML output from the main index screen specifies the oids of each item and the paths can be derived from
the labels in the graph.
With no action specified, it defaults to C<dump>.
=item C<< action=call >>
Invokes a method or code ref.
It does I<not> invoke object references.
Requires either C<oid> or C<path> be specified.
You may also set C<arg0>, C<arg1>, C<arg2> etc GET or POST parameters to pass data into the function.
There's currently no way to pass in an arbitrary object (see TODO below).
=item C<< action=method >>
Used with C<< method=[method name] >> and either an C<< oid=[oid] >> or C<< path=[path] >> to an
object reference, it calls that method on that object.
As above, takes argument data from C<arg0>, C<arg1>, C<arg2>, etc.
=item C<< lazy=1 >>
Avoid rebuilding the entire object graph to speed things up a bit.
=head2 TODO
C<oidarg[n]> to pass in an arbitrary other object as a parameter.
JSON posted to the server to specify arguments.
JSON posted to the server to specify the entire function/method call.
=head2 BUGS
There is no security. At all.
A lot of this stuff hasn't been tested. At all.
You will leak memory like crazy.
Really, I wasted about three days on this, so I'm very much in a "it compiles, ship it!" mode.
Want to see it rounded out better? Drop me some email.
=head1 HISTORY
=over 8
=item 0.01
Original version; created by h2xs 1.23 with options:
-A -C -X -b 5.8.0 -c -n Acme::RPC
=back
=head1 SEE ALSO
=head1 AUTHOR
Scott Walters, E<lt>scott@slowass.netE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2009 by Scott Walters
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.9 or,
at your option, any later version of Perl 5 you may have available.
USE AT YOUR OWN RISK.
NOT SUITABLE FOR ANY PURPOSE.
=cut
__END__
if(ref($object) eq 'HASH' and B::svref_2object($object)->NAME) {
# a HASH with a NAME is a stash (package).
my $package = B::svref_2object($object)->NAME;
use Devel::Leak;
# $lt or Devel::Leak::NoteSV($lt);
open my $olderr, '>&', \*STDERR or die "Can't dup STDERR: $!";
close STDERR;
open STDERR, ">", \my $buf or die $!;
Devel::Leak::CheckSV($lt);
# $buf =~ tr/A-Z/a-z/; print $buf;
close STDERR;
open STDERR, '>&', $olderr;
close $olderr;
$buf =~ s{(0x[a-f0-9]{6,})}{<a href="?oid=$1">$1</a>}g;
# $oid =~ m/^0x[0-9a-f]{8,}$/
( run in 0.798 second using v1.01-cache-2.11-cpan-39bf76dae61 )