RPC::Any::Server::JSONRPC::HTTP - A JSON-RPC server that understands HTTP
use RPC::Any::Server::JSONRPC::HTTP; # Create a server where calling Foo.bar will call My::Module->bar. my $server = RPC::Any::Server::JSONRPC::HTTP->new( dispatch => { 'Foo' => 'My::Module' }, allow_get => 0, ); # Read HTTP headers and JSON from STDIN and print result, # including HTTP headers, to STDOUT. print $server->handle_input(); # HTTP servers also take HTTP::Request objects, if you want. my $request = HTTP::Request->new(POST => '/'); $request->content('<?xml ... '); print $server->handle_input($request);
This is a type of RPC::Any::Server::JSONRPC that understands HTTP. It has all of the features of RPC::Any::Server, RPC::Any::Server::JSONRPC, and RPC::Any::Interface::HTTP. You should see those modules for information on configuring this server and the way it works.
The parser attribute (which you usually don't need to care about) in a JSONRPC::HTTP server is a JSON::RPC::Common::Marshal::HTTP (as opposed to the basic JSONRPC server, where it's a Marshal::Text instead of Marshal::HTTP).
parser
Since this is based on JSON::RPC::Common, it supports all the various HTTP GET specifications in the various "JSON-RPC over HTTP" specs, if you turn on allow_get.
allow_get
To install RPC::Any, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPC::Any
CPAN shell
perl -MCPAN -e shell install RPC::Any
For more information on module installation, please visit the detailed CPAN module installation guide.