UR::Se...Server(3pm)
π UR::Se...Server(3pm) β aka UR::Service::RPC::Server π
okay bestie, so you know those Perl docs where the title gets all chopped up because the terminal is being dramatic? yeah. this is UR::Service::RPC::Server, straight out of the User Contributed Perl Documentation, manual section 3pm. she's a whole class for building RPC servers and she is so ready to be your main character. π
β¨ NAME β¨
UR::Service::RPC::Server β a class for implementing RPC servers. that's the whole pitch. class. servers. RPC. periodt. π
π¦ SYNOPSIS π¦
here's the vibe in code form, no cap:
my $executer = Some::Exec::Class->create(fh => $fh);
my $server = UR::Service::RPC::Server->create();
$server->add_executer($executer);
$server->loop(5); # Process messages for 5 seconds
so you spin up an executer from Some::Exec::Class with a filehandle, make yourself a server, add_executer that executer to it, and then loop for 5 seconds like the icon you are. π
πΈ DESCRIPTION πΈ
ngl, the RPC server implementation isn't fleshed out very well yet, and it may change in the future. that's the official word, bestie, i'm not making it up. so likeβ¦ ship it, but keep an eye on her. she's still growing. π¦
π METHODS π
add_executer
$server->add_executer($exec);
okay so this is where you incorporate a new UR::Service::RPC::Executer instance into this server. it literally takes that Executer's filehandle and drops it into its own internal IO::Select object. that's it. that's the move. your executer is now part of the family. π«Ά
loop
$server->loop();
$server->loop(0);
$server->loop($timeout);
enter the Server's event loop for the given number of seconds. cute, right? but here's the fine print, and you need to know this:
- if the timeout is
undef, it will stay in the loop forever. forever forever. like, she's not coming back on her own. β - if the timeout is
0, it makes a single pass through the readable filehandles and callsexecuteon their Executer objects. one pass. in and out. blink and you'll miss her. π - if the return value of an Executer's
executemethod is false, that Executer's file handle gets removed from the internal Select object. so like, return false and you're out of the group chat. not me being dramatic, that's literally what it does. π
heads up bestie: undef means she loops forever. plan accordingly. β¨
π SEE ALSO π
go read these next, i promise they're worth it:
UR::Service::RPC::ExecuterUR::Service::RPC::Message
and that's the whole page, babe. this gem was documented in perl v5.32.1 and last touched on 2022-01-17 β so it's giving vintage-but-still-slay. go build something iconic with it. πβ¨π
π¦ 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