AnyEvent::JSONRPC::Utils - Helper functions for use with AnyEvent::JSONRPC
# XXX being either TCP or HTTP my $server = AnyEvent::JSONRPC::XXX::Server->new(); # Delegate methods to an object: my $object = Foo->new(); $server->reg_cb( method1 => delegate($object), ); # Delegate methods to another json-rpc server my $client = AnyEvent::JSONRPC::XXX::Client->new(); $server->reg_cb( method2 => delegate($client), ); # Delegate all methods from moose object my $object = Bar->new(); $server->reg_cb( do_moose($object), );
This module provides a couple of helper functions for creating JSON-RPC servers. This is kind of experimental at the moment.
This function returns a generic subroutine usable for registering method calls. The same subroutine can be used for registering multiple methods delegated to the same object.
$object is a AnyEvent::JSONRPC client method calls will be proxied through this client, otherwise it is assumed to be method calls on the object.
This function returns a complete delegation of methods to a Moose object. Some methods are considered protected and should be explicitly registered if needed. This includes all method names starting with an underscore, all methodnames consisting of only capital letters, and the following methods generated by Moose:
Peter Makholm <email@example.com>
Copyright (c) 2010 by Peter Makholm.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.