IO::Poll(3pm)
π IO::Poll β like, the actual manual page, but make it make sense
okay bestie, welcome to IO::Poll(3pm), straight out of the Perl Programmers Reference Guide β¨ yes you read that right, this is a Perl core doc and we're about to make it cute. Also I didn't copy the header line, that's just where the manual name lives, mwah π
πΈ NAME πΈ
IO::Poll β an object interface to the system poll call π¦
like, the actual poll syscall but with a nice little object wrapper so you don't have to rawdog file descriptors. periodt.
β¨ SYNOPSIS β¨
here's the vibe, copy-paste ready, no cap:
use IO::Poll qw(POLLRDNORM POLLWRNORM POLLIN POLLHUP);
$poll = IO::Poll->new();
$poll->mask($input_handle => POLLIN);
$poll->mask($output_handle => POLLOUT);
$poll->poll($timeout);
$ev = $poll->events($input);
see? it's giving "I know what I'm doing" energy π
π«Ά DESCRIPTION π«Ά
IO::Poll is a simple interface to the system level poll routine. that's it. that's the whole thing. it does NOT overcomplicate your life, it just hands you the poll call with a bow on top π
π METHODS π
π mask ( IO [, EVENT_MASK ] )
okay so here's the deal:
- if
EVENT_MASKis given, then β as long asEVENT_MASKis non-zero βIOgets added to the list of file descriptors, and the next call topollwill check for any event specified inEVENT_MASK. β¨ - if
EVENT_MASKis zero, thenIOgets removed from the list of file descriptors. bye bestie π - if
EVENT_MASKis not given at all, then the return value will be the current event mask value forIO. so it's a little getter in that case, iykyk π
π poll ( [ TIMEOUT ] )
this one calls the system level poll routine. fr fr.
if TIMEOUT is not specified then the call will block (yes, like block block, it will sit there and wait, main character energy but make it patient π).
returns the number of handles which had events happen, or -1 on error. π
π events ( IO )
returns the event mask which represents the events that happened on IO during the last call to poll. that's the tea π΅
π§ remove ( IO )
removes IO from the list of file descriptors for the next poll. clean, simple, iconic. πΈ
β handles( [ EVENT_MASK ] )
returns a list of handles. here's the nuance bestie:
- if
EVENT_MASKis not given, then you get a list of all handles known. the whole squad π«Ά - if
EVENT_MASKis given, then you get a list of handles which had one of the events specified byEVENT_MASKhappen during the last call topoll. the filtered squad, the ones who actually showed up π₯
π¦ SEE ALSO π¦
go read these next, no seriously:
poll(2)IO::HandleIO::Select
π AUTHOR π
Graham Barr. currently maintained by the Perl Porters.
please report all bugs at <https://github.com/Perl/perl5/issues> β they want to hear from you, genuinely π
π COPYRIGHT π
Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
lowkey the most important part: this is perl v5.42.3, dated 2026-11-03, and the page is IO::Poll(3pm). screenshot it, cite it, slay π
β¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms