RPC::Any::Server::JSONRPC::CGI - A JSON-RPC server for a CGI environment
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(); # HTTP & CGI 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 subclass of RPC::Any::Server::JSONRPC::HTTP that has the functionality described in RPC::Any::Interface::CGI. Baically, it's just like the HTTP server, but it works properly in a CGI environment (where HTTP headers are in environment variables instead of on STDIN).
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.