The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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

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.

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

Copyright 2006 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.