JSON::RPC::Common::Procedure::Return - JSON-RPC procedure return class
version 0.10
use JSON::RPC::Common::Procedure::Return; # create a return from a call, retaining the ID my $return = $call->return_result("foo"); # inflate gets a version specific class my $return = JSON::RPC::Common::Procedure::Return->inflate( version => "2.0", result => "foo", id => $id, ); # you can specify a return with an error, it's just an attribute my $return = JSON::RPC::Common::Procedure::Return->new( error => ..., );
This class abstracts JSON-RPC procedure returns (results).
Version specific implementation are provided as well.
The ID of the call this is a result for.
Results with no ID are typically error results for parse fails, when the call ID could never be determined.
The JSON data that is the result of the call, if any.
The error, if any. This is a JSON::RPC::Common::Procedure::Return::Error object (or a version specific subclass).
The error class to use when instantiating errors.
Go to and from JSON data.
Helpers for managing the error sub object.
Calls create_error with it's arguments and sets the error to that.
create_error
E.g.
$res->set_error("foo"); $res->error->message; # "foo"
Instantiate a new error of class error_class using "new_dwim" in JSON::RPC::Common::Procedure::Return::Error.
Yuval Kogman <nothingmuch@woobling.org>
This software is copyright (c) 2011 by Yuval Kogman.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install JSON::RPC::Common, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JSON::RPC::Common
CPAN shell
perl -MCPAN -e shell install JSON::RPC::Common
For more information on module installation, please visit the detailed CPAN module installation guide.