|
NAMEJSON::RPC::Legacy::Client - Perl implementation of JSON-RPC client SYNOPSIS use JSON::RPC::Legacy::Client;
my $client = new JSON::RPC::Legacy::Client;
my $url = 'http://www.example.com/jsonrpc/API';
my $callobj = {
method => 'sum',
params => [ 17, 25 ], # ex.) params => { a => 20, b => 10 } for JSON-RPC v1.1
};
my $res = $client->call($uri, $callobj);
if($res) {
if ($res->is_error) {
print "Error : ", $res->error_message;
}
else {
print $res->result;
}
}
else {
print $client->status_line;
}
# Easy access
$client->prepare($uri, ['sum', 'echo']);
print $client->sum(10, 23);
DESCRIPTIONThis is JSON-RPC Client. See <http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html>. Gets a perl object and convert to a JSON request data. Sends the request to a server. Gets a response returned by the server. Converts the JSON response data to the perl object. JSON::RPC::Legacy::ClientMETHODS
JSON::RPC::Legacy::ReturnObject"call" method or the methods set by "prepared" returns this object. (The returned JSON data is decoded by the JSON coder object which was passed by the client object.) METHODS
JSON::RPC::Legacy::ServiceObjectRESERVED PROCEDUREWhen a client call a procedure (method) name 'system.foobar', JSON::RPC::Legacy::Server look up MyApp::system::foobar. <http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ProcedureCall> <http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ServiceDescription> There is JSON::RPC::Legacy::Server::system::describe for default response of 'system.describe'. SEE ALSO<http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html> <http://json-rpc.org/wiki/specification> AUTHORMakamaka Hannyaharamitu, <makamaka[at]cpan.org> COPYRIGHT AND LICENSECopyright 2007-2008 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|