Catalyst-Plugin-Server

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    Catalyst::Plugin::Server::XMLRPC -- Catalyst XMLRPC Server Plugin

SYNOPSIS
        package MyApp;
        use Catalyst qw/Server Server::XMLRPC/;

        package MyApp::Controller::Example;
        use base 'Catalyst::Controller';

        sub echo : XMLRPC {                     # available as: example.echo
            my ( $self, $c, @args ) = @_;
            $c->stash->{xmlrpc} = join ', ', @args;
        }

        sub ping : XMLRPCPath('/ping') {        # available as: ping
            my ( $self, $c ) = @_;
            $c->stash->{xmlrpc} = 'Pong';
        }

        sub world : XMLRPCRegex(/hello/) {      # available as: *hello*
            my ($self, $c) = @_;
            $c->stash->{xmlrpc} = 'World';
        }

        sub echo : XMLRPCLocal {                # available as: example.echo
            my ( $self, $c, @args ) = @_;
            $c->stash->{xmlrpc} = join ', ', @args;
        }

        sub ping : XMLRPCGlobal {               # available as: ping
            my ( $self, $c ) = @_;
            $c->stash->{xmlrpc} = 'Pong';
        }

DESCRIPTION
    XMLRPC Plugin for Catalyst which we tried to make compatible with the
    way Catalyst works with URLS. Main features are:

    * Split XMLRPC methodNames by STRING to find out Controller.
    * Single entrypoint for XMLRPC calls, like http://host.tld/rpc
    * DispatchTypes (attributes) which work much the same as Catalyst attrs
    * XMLRPC Parameter handling transparent to Catalyst parameter handling

HOW IT WORKS
    The default behaviour will handle XMLRPC Requests sent to "/rpc" by
    creating an OBJECT containing XMLRPC specific parameters in
    "$c->req->xmlrpc".

    Directly after, it will find out the Path of the Action to dispatch to,
    by splitting methodName by ".":

      methodName: hello.world
      path      : /hello/world

    From this point, it will dispatch to '/hello/world' when it exists, like
    Catalyst Urls would do. What means: you will be able to set Regexes,
    Paths etc on subroutines to define the endpoint.

    We discuss these custom XMLRPC attributes below.

    When the request is dispatched, we will return $c->stash->{xmlrpc} to
    the xmlrpc client, or, when it is not available, it will return
    $c->stash to the client. There is also a way of defining $c->stash keys
    to be send back to the client.

ATTRIBUTES
    You can mark any method in your Catalyst application as being available
    remotely by using one of the following attributes, which can be added to
    any existing attributes, except Private. Remember that one of the
    mentioned attributes below are automatically also Privates...

    XMLRPC
        Make this method accessible via XMLRPC, the same way as Local does
        when using catalyst by URL.

        The following example will be accessible by method "hello.world":

          package Catalyst::Controller::Hello
          sub world : XMLRPC {}

    XMLRPCLocal
        Identical version of attribute "XMLRPC"

    XMLRPCGlobal
        Make this method accessible via XMLRPC, the same way as GLOBAL does
        when using catalyst by URL.

        The following example will be accessible by method "ping":

          package Catalyst::Controller::Hello
          sub ping : XMLRPCGlobal {}

    XMLRPCPath('/say/hello')
        Make this method accessible via XMLRPC, the same way as Path does
        when using catalyst by URL.

        The following example will be accessible by method "say.hello":

          package Catalyst::Controller::Hello
          sub hello : XMLRPCPath('/say/hello') {}

    XMLRPCRegex('foo')
        Make this method accessible via XMLRPC, the same way as Regex does
        when using catalyst by URL.

        The following example will be accessible by example methods:
        "a.foo.method" "wedoofoohere" "foo.getaround"

          package Catalyst::Controller::Hello
          sub hello : XMLRPCPath('foo') {}

ACCESSORS
    Once you've used the plugin, you'll have an $c->request->xmlrpc accessor
    which will return an "Catalyst::Plugin::Server::XMLRPC" object.

    You can query this object as follows:



( run in 0.547 second using v1.01-cache-2.11-cpan-39bf76dae61 )