UR::Se...ecuter(3pm)
π NAME π
okay so bestie, welcome to UR::Service::RPC::Executer (that's the 3pm one, perl gang rise up) β it's the base class for modules implementing RPC executers. she's abstract, she's a blueprint, she's iconic π
πΈ DESCRIPTION πΈ
So this class is an abstract base class used to implement RPC executers. And what is an RPC executer, you ask? It's a module that's meant to have its methods called from another process, and then have the results passed back to the original caller. no cap π«Ά
The communication? It happens over a read-write filehandle β like a socket β by passing UR::Service::RPC::Message objects back and forth. it's giving pen pals but make it IPC π
Executers are subordinate to a UR::Service::RPC::Server object, and the Server is the one doing the heavy lifting, fr fr:
- it handles decoding the message passed over the socket
- it calls the method on the correct executor, in the right context
- it returns the result back through the file handle
so basically the Server is the main character and the Executer is the extremely competent bestie holding it down behind the scenes π
β¨ PROPERTIES β¨
fh=>IO::Handleβ the file handle that messages are received on and responses are sent to πuse_sigio=>Booleanβ if true, the Server will set up a callback on the IO signal to handle execution, so the Server does not need to block inloop(). lowkey a glow-up for your event loop β
π¦ METHODS π¦
authenticate
$bool = $exec->authenticate($msg);
This one gets called by execute() right after the message object is deserialized from the filehandle. The default implementation just returns true β she's trusting like that π
Subclasses can override this to examine the UR::Service::RPC::Message object and return true or false on whether it should allow or disallow execution.
β οΈ If authentication fails, the Executor should modify the Message object in-place with a proper return value and exception. don't skip this part bestie, it matters π
execute
$exec->execute();
Called when the Server detects that data is available to read on its file handle. she then:
- deserializes the message
- calls
authenticate
If authentication fails, she immediately passes the message object back to the caller. bye π
If authentication succeeds though? then she calls the appropriate method in the Executer package, and creates a brand new Message object with the return value to pass back to the caller. slay β¨
close_connection
$exec->close_connection();
Called by execute() when it detects that the file handle has closed. rip to that connection, she served her purpose ποΈ
Derived classes should define additional methods that then become callable by execute(). yes, you're building the menu, the Server just orders from it π
π SEE ALSO π
UR::Service::RPC::ServerUR::Service::RPC::Message
go read those next, iykyk π
and that's the whole vibe, bestie β this page came straight from the User Contributed Perl Documentation, running under perl v5.32.1, dated 2022-01-17. periodt. π
π¦ 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