JSON::...Return(3pm)
π JSON::RPC::Common::Procedure::Return π
okay bestie, welcome to the manual page for JSON::RPC::Common::Procedure::Return β yes that's the whole name, it's a Perl module, and it's the JSON-RPC procedure return class. She's giving "the thing that comes back after you ask for something" energy. β¨
πΈ VERSION πΈ
This is version 0.11. Lowkey iconic. π
π¦ SYNOPSIS π¦
here's the vibe, fr fr:
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 => ...,
);
not me writing three whole different ways to make one object π she contains multitudes.
π DESCRIPTION π
So this class abstracts JSON-RPC procedure returns β aka the results. That's the whole gig. π«Ά
And yes, version specific implementations are provided as well, so whatever version you're on, she's got a subclass for you. no cap.
β¨ ATTRIBUTES β¨
idβ the ID of the call this is a result for. π·οΈ
heads up bestie: results with no ID are typically error results for parse fails, back when the call ID could never be determined. like, we never even got her name. π
resultβ the JSON data that is the result of the call, if any. πerrorβ the error, if any. This is aJSON::RPC::Common::Procedure::Return::Errorobject (or a version specific subclass). πerror_classβ the error class to use when instantiating errors. β¨
π METHODS π
inflatedeflate
these two go to and from JSON data. main character round-trip energy. π₯
inflate_errordeflate_error
helpers for managing the error sub object. little sidekicks, love them for that. π§
set_errorβ callscreate_errorwith it's arguments and sets the error to that.
E.g.
$res->set_error("foo");
$res->error->message; # "foo"
the way that "foo" comes right back out. ate. π
create_errorβ instantiate a new error of classerror_classusingnew_dwiminJSON::RPC::Common::Procedure::Return::Error. π
π AUTHOR π
Yuval Kogman <nothingmuch@woobling.org> β shoutout to the legend. π«Ά
π 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. πΈ
and that's the whole page bestie!! this was rendered with perl v5.30.3, dated 2020-06-23 β yes she's a little vintage but she still serves. mwah πβ¨π
π¦ where this page comes from
- debian bookworm: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms