The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JSON::RPC::Dispatcher::Procedure - The data holder between RPC requests and responses.

VERSION

version 0.0506

SYNOPSIS

 use JSON::RPC::Dispatcher::Procedure;

 my $proc = JSON::RPC::Dispatcher::Procedure->new;

 $proc->error_code(300);

 my $method = $proc->method;

DESCRIPTION

Something needs to act as an intermediary to hold the data and state of requests coming in, RPC being called, and responses going out. THis module fits that bill.

error_code ( [ code ] )

Returns the current error code.

code

An integer. Sets an error code.

has_error_code ( )

Returns a boolean indicating whether an error code has been set.

error_message ( [ message ] )

Returns the current error message.

message

A string. Sets an error message.

error_data ( [ data ] )

Returns the current error data. Error data is entirely defined by the application (e.g. detailed error information, nested errors etc.).

data

A scalar or reference. Sets an error data.

error ( code, message, [ data ] )

invalid_request ( [ data ] )

Sets an Invalid Request error as defined by the JSON-RPC 2.0 spec.

data

Optionally set some error data for the error.

method_not_found ( [ data ] )

Sets a Method Not Found error as defined by the JSON-RPC 2.0 spec.

data

Optionally set some error data for the error.

invalid_params ( [ data ] )

Sets an Invalid Params error as defined by the JSON-RPC 2.0 spec.

data

Optionally set some error data for the error.

internal_error ( [ data ] )

Sets an Internal Error as defined by the JSON-RPC 2.0 spec.

data

Optionally set some error data for the error.

method ( [ name ] )

Returns the name of the procedure to be called.

name

An alphanumeric string. Sets the method name. Will set an error if the method name is not alpha-numeric.

params ( [ data ] )

Returns the parameters to be passed into the procedure.

data

An array or hashref. Sets the parameters. Will set an error if the params are not an array ref or hash ref.

id ( [ id ] )

Returns the id of the request.

id

Sets the id of the request.

result ( [ data ] )

Returns the data that will be sent back to the client.

data

Sets the data that will be sent back to the client.

response ( )

Formats the data stored in this object into the data structure expected by JSON::RPC::Dispatcher, which will ultimately be returned to the client.

LEGAL

JSON::RPC::Dispatcher is Copyright 2009-2010 Plain Black Corporation (http://www.plainblack.com/) and is licensed under the same terms as Perl itself.