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

NAME

Beekeeper::JSONRPC::Response - Representation of a JSON-RPC response.

VERSION

Version 0.06

SYNOPSIS

  my $client = Beekeeper::Client->instance;
  
  my $resp = $client->call_remote(
      method => 'myapp.svc.foo',
      params => { foo => 'bar' },
  );
  
  die unless ($resp->success);

  print $resp->result;

DESCRIPTION

Objects of this class represent a JSON-RPC response (see http://www.jsonrpc.org/specification).

When an RPC call is made the worker replies with a Beekeeper::JSONRPC::Response object if the invoked method was executed successfully. On error, a Beekeeper::JSONRPC::Error is returned instead.

Method Beekeeper::Client::call_remote returns objects of this class on success.

ACCESSORS

result

Returns the arbitrary value or data structure returned by the invoked method. It is undefined if the invoked method does not returns anything.

id

Returns the id of the request it is responding to. It is unique per client connection, and it is used for response matching.

success

Always returns true. It is used to determine if a method was executed successfully or not ($response-\result> cannot be trusted as it may be undefined on success).

AUTHOR

José Micó, jose.mico@gmail.com

COPYRIGHT AND LICENSE

Copyright 2015-2021 José Micó.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.

This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.