UR::Se...Message(3pm)
π UR::Se...Message(3pm) β aka UR::Service::RPC::Message π
okay bestie, so this is a page from the User Contributed Perl Documentation and it's all about a lil class called UR::Service::RPC::Message. pull up a chair, we're gonna get into it π«Ά
β¨ NAME β¨
UR::Service::RPC::Message β a Serializable object that's literally built to be sent around as an RPC message. it's giving "I was made for this". π
πΈ SYNOPSIS πΈ
here's the vibe, exactly as it goes down:
my $msg = UR::Service::RPC::Message->create(
target_class => 'URT::RPC::Thingy',
method_name => 'join',
params => ['-', @join_args],
'wantarray' => 0,
);
$msg->send($fh);
my $resp = UR::Service::RPC::Message->recv($fh, 5);
like. iconic. make it, send it, receive it. periodt. π
π¦ DESCRIPTION π¦
so this class is used as a message-passing interface by the RPC service modules. that's the whole job. she's the messenger. no cap. π
π PROPERTIES π
these ones? the initiating caller should fill 'em in π
method_name=> Text β the name of the subroutine the initiator whishes to call. yes girl, whishes, we don't make the rules π«Άtarget_class=> Text β the namespace the initiator wants the subroutine to be called in.params=> ARRAY β the list of parameters to pass to the subroutine.wantarray=> Boolean β whatwantarray()context the subroutine should be called in. lowkey important, don't skip it.
and these ones get assigned after the RPC call to the subroutine π
return_values=> ARRAY β the list of values returned by the subroutine.exceptionβ okay so on the receiving side, the subroutine is called within aneval. if there was an exception,exceptionstores the value of$@, or the empty string. and heads up: the receiving side should also fill-inexceptionif there was an authentication failure. π₯fhβrecvfills this in with the file handle the message was read from.
π METHODS π
send
$bytes = $msg->send($fh);
Serializes the Message object with FreezeThaw and writes the data to the filehandle $fh. Returns the number of bytes written. and ngl, $bytes will be false if there was an error, so check it bestie π
recv
$response = UR::Service::RPC::Message->recv($fh,$timeout);
$response = $msg->recv();
Reads a serialized Message from the filehandle and constructs a Message object that is then returned to the caller.
okay but the two forms hit different:
- first case: it reads from the given filehandle, waiting a maximum of
$timeoutseconds withselectbefore giving up. β³ - second case: it reads from whatever filehandle is stored in
$msgto read data from. π¦
β SEE ALSO β
UR::Service::RPC::Server, UR::Service::RPC::Executor
and that's the whole page, bestie!! π₯³ this was perl v5.32.1, dated 2022-01-17 β shoutout to whoever wrote her, she ate π
β¨ mwah π
π¦ where this page comes from
- debian bookworm: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libur-perl 0.470+ds-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