NAME

RPC::JSON - JSON-RPC Client Library

SYNOPSIS

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'
     }
];

DESCRIPTION

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.

METHODS

shell

Instantiate a JSON-RPC shell

new(<smd source>)

Return a new RPC::JSON object for a given SMD source

set_smd

Sets the current SMD file, via URI

connect ?SMD?

Connects to the specified SMD file, or whichever was configured with. This will initialize the JSON-RPC service.

load_smd

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.

is_utf8

makes the call to from_json utf8 aware (see perldoc JSON)

$jsonrpc->is_utf8( 1 );

default state is non utf8

service

Return the object name of the current service connected to, or undef if not connected.

methods

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 }, ... ] }

serviceURI

Returns the serviceURI (not the SMD URI, the URI to request RPC calls against), or undef if not connected.

AUTHORS

J. Shirley <jshirley@gmail.com>

CONTRIBUTORS

Chris Carline Lee Johnson

LICENSE

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.