RPC::JSON - JSON-RPC Client Library
use RPC::JSON; my $jsonrpc = RPC::JSON->new( "http://www.simplymapped.com/services/geocode/json.smd" ); # Imports a geocode(['address']) method: $jsonrpc->geocode('1600 Pennsylvania Ave');
Dumping this function returns whatever data was returned from the server. In this case:
$VAR1 = [ { 'administrativearea' => 'DC', 'country' => 'US', 'longitude' => '-77.037691', 'subadministrativearea' => 'District of Columbia', 'locality' => 'Washington', 'latitude' => '38.898758', 'thoroughfare' => '1600 Pennsylvania Ave NW', 'postalcode' => '20004', 'address' => '1600 Pennsylvania Ave NW, Washington, DC 20004, USA' } ];
RPC::JSON aims to be a full-featured JSON-RPC client library that enables a client to connect to any JSON-RPC service and dispatch remote method calls.
Instantiate a JSON-RPC shell
Return a new RPC::JSON object for a given SMD source
Sets the current SMD file, via URI
Connects to the specified SMD file, or whichever was configured with. This will initialize the JSON-RPC service.
load_smd will process a given SMD file by converting from JSON to a Perl native structure, and setup the various keys as well as the autoload handles for calling the methods.
makes the call to from_json utf8 aware (see perldoc JSON)
$jsonrpc->is_utf8( 1 );
default state is non utf8
Return the object name of the current service connected to, or undef if not connected.
Return a structure of method names for use on the current service, or undef if not connected.
The structure looks like: { methodName1 => [ { name => NAME, type => DATATYPE }, ... ] }
Returns the serviceURI (not the SMD URI, the URI to request RPC calls against), or undef if not connected.
J. Shirley <jshirley@gmail.com>
<jshirley@gmail.com>
Chris Carline Lee Johnson
Copyright 2006-2008 J. Shirley <jshirley@gmail.com>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. That means either (a) the GNU General Public License or (b) the Artistic License.
To install RPC::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPC::JSON
CPAN shell
perl -MCPAN -e shell install RPC::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.