IO::Eve...Callback(3)
π NAME π
okay so bestie, welcome to the IO::Eve...Callback(3) page β it lives under User Contributed Perl Documentation, and the module is IO::Event::Callback: a closure based API for IO::Event. slay. β¨
π SYNOPSIS π
here's the vibe, literally copy these exactly:
use IO::Event::Callback;
IO::Event::Callback->new($filehanle, %callbacks);
use IO::Event::INET::Callback;
IO::Event::INET::Callback->new(%socket_info, %callbacks);
use IO::Event::UNIX::Callback;
IO::Event::UNIX::Callback->new(%socket_info, %callbacks);
lowkey yes, $filehanle is spelled like that in the original β I'm not touching it, periodt. π
πΈ DESCRIPTION πΈ
IO::Event::Callback is a wrapper around IO::Event. it gives you an alternative interface to using IO::Event, and honestly it's giving convenience. π¦
instead of defining a class with methods like ie_input, you provide the callbacks as code references when you create the object. main character energy, fr fr.
the keys for the callbacks are the same as the callbacks for IO::Event, except the ie_ prefix is removed. that's it, that's the rule. π
π¦ EXAMPLE π¦
use IO::Event::Callback;
my $remote = IO::Event::Callback::INET->new(
peeraddr => '10.20.10.3',
peerport => '23',
input => sub {
# handle input
},
werror => sub {
# handdle error
},
eof => sub {
# handle end-of-file
},
);
note:IO::Event::Callback::INET,werror, and# handdle errorare exactly as the page has them. no edits, no cap. π
π SEE ALSO π
check the source for RPC::ToWorker for an exmaple use of IO::Event::Callback β yep, exmaple is the original spelling, and I'm keeping it because details matter. π₯
mwah π that's the whole page. it's from perl v5.42.0, dated 2016-12-07, and the footer title is IO::Eve...Callback(3). π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-IO-Event 0.813-bp160.1.12 Β· GPL-1.0+ or Artistic-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms