JSON::RPC::Simple::Client - JSON-RPC 1.1 WD client
use JSON::RPC::Simple::Client; my $c = JSON::RPC::Simple::Client->new("https://www.example.com/json-rpc"); my $results = $c->echo("foo");
This class uses an AUTOLOAD subroutine so that any method calls are sent to the target JSON-RPC service.
To create a new client either use the new method in directly or via the helper function JSON::RPC::Simple-connect>.
new
JSON::RPC::Simple-
Creates a new client whos endpoint is given in URL.
Valid options:
Set this to a true value to do calls via HTTP GET instead of POST as some services apparently think this is a good idea.
What to send as HTTP User-Agent, defaults to "JSON::RPC::Simple <version>" where version is the current version number of the JSON::RPC::Simple package.
Timeout for how long the call may take. Is passed to LWP::UserAgent which is used to make the request by default. Defaults to 180 sec
The JSON encoder/decoder to use. Defaults to JSON->new->utf8. The supplied object/class must respond to encode and decode.
encode
decode
Turn on debugging which prints to STDERR.
By default this class uses LWP::UserAgent. If you wish to use something else such as for example WWW::Curl simply replace the ua member of the instance with something that provides a LWP::UserAgent compatible API for post. The returned object from the post method is expected to provide is_success, decoded_content and content_type.
ua
post
is_success
decoded_content
content_type
To install JSON::RPC::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JSON::RPC::Simple
CPAN shell
perl -MCPAN -e shell install JSON::RPC::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.