---
name: "JSON::RPC::Common::Procedure::Return"
section: "3pm"
platform: "linux"
package: "libjson-rpc-common-perl"
version: "0.11-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/JSON::RPC::Common::Procedure::Return"
---

# JSON::RPC::Common::Procedure::Return(3pm)

JSON-RPC procedure return class

## NAME

JSON::RPC::Common::Procedure::Return - JSON-RPC procedure return class

## VERSION

version 0.11

## SYNOPSIS

```
        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 => ...,
        );
```

## DESCRIPTION

This class abstracts JSON-RPC procedure returns (results).

Version specific implementation are provided as well.

## ATTRIBUTES

- id

  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.

- result

  The JSON data that is the result of the call, if any.

- error

  The error, if any. This is a JSON::RPC::Common::Procedure::Return::Error object (or a version specific subclass).

- error\_class

  The error class to use when instantiating errors.

## METHODS

- inflate

  - deflate

  Go to and from JSON data.

- inflate\_error

  - deflate\_error

  Helpers for managing the error sub object.

- set\_error

  Calls `"create_error"` with it's arguments and sets the error to that.

  E.g.

  ```
          $res->set_error("foo");
          $res->error->message; # "foo"
  ```

- create\_error

  Instantiate a new error of class error\_class using "new\_dwim" in JSON::RPC::Common::Procedure::Return::Error.

## AUTHOR

Yuval Kogman \<nothingmuch@woobling.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Yuval Kogman and others.

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