Group
Extension

Matches 7

RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any.pm ( view source; MetaCPAN )
PC and JSON-RPC.

=head1 DESCRIPTION

RPC::Any is a simple, unified interface to multiple RPC protocols.
Right now it supports L<XML-RPC|http://www.xmlrpc.com/> and all
three versions of L<JSON-RPC|ht
tp://groups.google.com/group/json-rpc/web>
(1.0, 1.1, and 2.0).

The goal of RPC::Any is to be simple to use, and to be highly extendable.
RPC::Any is designed to work properly in taint mode, and full
RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any/Server/JSONRPC/CGI.pm ( view source; MetaCPAN )
erver::JSONRPC::CGI;
use Moose;
extends 'RPC::Any::Server::JSONRPC::HTTP';
with "RPC::Any::Interface::CGI";

__PACKAGE__->meta->make_immutable;

1;

__END__

=head1 NAME

RPC::Any::Server::JSONRPC::CG

=head1 SYNOPSIS

 use RPC::Any::Server::JSONRPC::CGI;
 # Create a server where calling Foo.bar will call My::Module->bar.
 my $server = RPC::Any::Server::JSONRPC::CGI->new(
    dispatch  => { 'Foo' =
> 'My::Module' },
    allow_get => 0,
 );
 # Read JSON from STDIN, headers from the environment. Print result,
 # including HTTP headers for a CGI environment, to STDOUT.
 print $server->handle_input(
RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any/Server/JSONRPC.pm ( view source; MetaCPAN )
ny::Server::JSONRPC;
use Moose;
use Class::MOP;
use JSON::RPC::Common::Marshal::Text;
use RPC::XML qw(smart_encode);

extends 'RPC::Any::Server';

has parser    => (is => 'rw', isa => 'JSON::RPC::Comm
on::Marshal::Text',
                  lazy_build => 1);
has _last_call => (is => 'rw', isa => 'JSON::RPC::Common::Procedure::Call',
                   clearer => '_clear_last_call');
has default_versi
 => 'rw', isa => 'Str', default => '2.0');
has '+package_base' => (default => 'RPC::Any::Package::JSONRPC');

before 'get_input' => sub {
    my $self = shift;
    $self->_clear_last_call();
};

sub d
RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any/Exception.pm ( view source; MetaCPAN )
ified at
L<http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php> (which
are valid for both JSON-RPC and XML-RPC).

What follows is a brief description of each type of error (which is
a subclass
RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any/Package/JSONRPC.pm ( view source; MetaCPAN )
package RPC::Any::Package::JSONRPC;
use strict;
use JSON;
use MIME::Base64;

BEGIN { *rpc_type = \&type };

sub type {
    my ($self, $type, $value) = @_;

    # This is the only type that does someth
g special with undef.
    if ($type eq 'boolean') {
        return $value ? JSON::true : JSON::false;
    }

    return JSON::null if !defined $value or $type eq 'nil';

    my $retval = $value;

    
al = 0.0 + $value;
    }
    elsif ($type eq 'string') {
        # Forces string context, so that JSON will make it a string.
        $retval = "$value";
    }
    elsif ($type eq 'base64') {
        
RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any/Server/JSONRPC/HTTP.pm ( view source; MetaCPAN )
 RPC::Any::Server::JSONRPC::HTTP;
use Moose;
use JSON::RPC::Common::Marshal::HTTP;
use HTTP::Response; # Needed because Marshal::HTTP doesn't load it.
extends 'RPC::Any::Server::JSONRPC';
with 'RPC::A
ny::Interface::HTTP';

has '+parser' => (isa => 'JSON::RPC::Common::Marshal::HTTP');

sub decode_input_to_object {
    my ($self, $request) = @_;
    if (uc($request->method) eq 'POST' and $request->c
 eq '') {
        $self->exception("ParseError",
                         "You did not supply any JSON to parse in the POST body.");
    }
    elsif (uc($request->method) eq 'GET' and !$request->uri->
RPC-Any ( M/MK/MKANAT/RPC-Any-1.00.tar.gz, MKANAT, 2010; MetaCPAN )
RPC-Any/lib/RPC/Any/Server.pm ( view source; MetaCPAN )
ber without any
quotes on it in JSON-RPC.

=item double

A floating-point number. Translates to C<< <double> >> in XML-RPC and
a number without any quotes on it, in JSON-RPC. (Note, though, that
numbe
>> in XML-RPC and
a quoted string in JSON-RPC.

=item boolean

A true or false value. Translates to C<< <boolean> >> in XML-RPC,
with a C<0> or C<1> value. In JSON-RPC, translates to C<true> or
C<fals
ly way to transfer
binary data using RPC::Any. In XML-RPC, this translates to C<< <base64> >>.
In JSON-RPC it becomes a quoted string containing base64.

=item dateTime

A date and time. In XML-RPC, t

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.