JSON::...::Call(3pm)
β¨ JSON::RPC::Common::Procedure::Call β¨
okay bestie, gather round, we're doing the JSON::...::Call(3pm) page, from the User Contributed Perl Documentation. this is the JSON::RPC::Common::Procedure::Call base class, and she is iconic π
πΈ VERSION πΈ
version 0.11 β that's the vibe, that's the era, periodt.
π¦ SYNOPSIS π¦
use JSON::RPC::Common::Procedure::Call;
my $req = JSON::RPC::Common::Procedure::Call->inflate({ ... });
warn "HALLO JSONRPC VERSION " . $req->version;
literally that's it. that's the whole entrance. no cap π«Ά
π DESCRIPTION π
so a JSON-RPC Procedure Call β and yes, the original author is over here like rolls eyes, what was even wrong with just calling it a "request"?? β is either a notification or a method invocation in JSON-RPC. two moods, one class. π
peep <http://json-rpc.org/wiki/specification> β keep that URL handy as http://json-rpc.org/wiki/specification if u wanna read the spec for more deets. iykyk β¨
π ATTRIBUTES π
quick heads up before we go: all attributes are read only unless the docs say otherwise. no sneaky writes, bestie. π
versionβ she's here, she's an attribute, that's the whole note. βidβ The request ID.
used to correlate a request to a response, aka how u know which reply goes with which ask. matching energy fr fr π§
methodβ The name of the method to invoke. say it with ur chest.paramsβ returns a reference to the parameters hash or array. hash or array, she contains multitudes πreturn_classβ one of the classes u instantiate the response objects from.error_classβ the other one of the classes u instantiate the response objects from.
these two vary per subclass! every subclass does its own thing, no uniform here. π
π₯ METHODS π₯
inflateβ a factory constructor. she delegates tonewon a subclass, picked based on the protocol version.
this is the recommended constructor. yes queen, use this one. π
deflateβ flatten to JSON data. squish it down, send it out. β¨newβ the actual constructor.
not intended for normal use on this class β u should be using a subclass most of the time, ok?
calling JSON::RPC::Common::Procedure::Call->new will construct a call with an undefined version, which cannot be deflated (and thus can't be sent over the wire). still useful for testing ur own code's RPC handling, so this is not allowed.
π¨ wait. read that again. it says "this is still useful for testing... so this is not allowed." that's literally what the original says. so like, it's useful, and also not allowed. do with that information what u will. π
params_listβ dereferencesparamsregardless of representation.
returns a list of positionals or a key/value list. either way u get a list, bestie. π
return_result $resultβ create a newJSON::RPC::Common::Procedure::Returnwith a result.return_error %error_paramsβ create a newJSON::RPC::Common::Procedure::Returnwith an error.
(yeah these two are a duo, one for the good timeline, one for the bad one π)
is_notificationβ whether this request is a notification, aka a method that does not need a response. she said don't text back. πis_serviceβ whether this request is a JSON-RPC 1.1 service method (e.g.system.describe).
this method is always false for 1.0 and 2.0. so if ur on those versions, don't even ask, the answer is no. π
call $objβ a convenience method to invoke the call on$objand create a new return with the return value. run it, catch the result, slay. π
π AUTHOR π
Yuval Kogman <nothingmuch@woobling.org> β the icon, the legend, the one who wrote this whole thing. π«Ά
π 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.
okay that's the whole page, and ur lil sign-off is: this was rendered from perl v5.30.3, dated 2020-06-23, and she goes by JSON::...::Call(3pm) πβ¨ bye bestie, go inflate something responsibly π¦
π¦ 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