XAS::Lib::RPC::JSON::Client - A mixin for a JSON RPC interface
package Client use XAS::Class debug => 0, version => '0.01', base => 'XAS::Lib::RPC::JSON::Client', ; package main my $client = Client->new( -port => 9505, -host => 'localhost', ); $client->connect(); my $data = $client->call( -method => 'test' -id => $id, -params => {} ); $client->disconnect();
This modules implements a simple JSON RPC v2.0 client. It doesn't support "Notification" calls.
This module inherits from XAS::Lib::Net::Client.
This method is used to format the JSON packet and send it to the server. Any errors returned from the server are parsed and then thrown.
The name of the RPC method to invoke.
The id used to identify this method call.
A hashref of the parameters to be passed to the method.
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (c) 2012-2015 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.