Catalyst-Plugin-JSONRPC

 view release on metacpan or  search on metacpan

lib/Catalyst/Plugin/JSONRPC.pm  view on Meta::CPAN

Catalyst::Plugin::JSONRPC is a Catalyst plugin to add JSON-RPC methods
in your controller class. It uses a same mechanism that XMLRPC plugin
does and actually plays really nicely.

=head2 METHODS

=over 4

=item $c->json_rpc(%attrs)

Call this method from a controller action to set it up as a endpoint
for RPC methods in the same class.

Supported attributes:

=over 8

=item class

name of class to dispatch (defaults to current one)

lib/Catalyst/Plugin/JSONRPC.pm  view on Meta::CPAN

=back

=back

=head2 REMOTE ACTION ATTRIBUTE

This module uses C<Remote> attribute, which indicates that the action
can be dispatched through RPC mechanisms. You can use this C<Remote>
attribute and integrate JSON-RPC and XML-RPC together, for example:

  sub xmlrpc_endpoint : Regexp('^xml-rpc$') {
      my($self, $c) = @_;
      $c->xmlrpc;
  }

  sub jsonrpc_endpoint : Regexp('^json-rpc$') {
      my($self, $c) = @_;
      $c->json_rpc;
  }

  sub add : Remote {
      my($self, $c, $a, $b) = @_;
      return $a + $b;
  }

Now C<add> RPC method can be called either as JSON-RPC or



( run in 0.395 second using v1.01-cache-2.11-cpan-27979f6cc8f )