IO::Poll(3perl)
π IO::Poll β bestie edition π
okay so this is IO::Poll, and it's literally the object interface to the system poll call. it's from the Perl Programmers Reference Guide, it lives in section 3perl, and it's about to make your file-descriptor-wrangling life SO much cuter. π¦
β¨ SYNOPSIS β¨
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);
that's the whole vibe bestie. hand it some handles, give them a mask, poll it, read the events. iconic behavior. π
πΈ DESCRIPTION πΈ
IO::Poll is a simple interface to the system level poll routine. that's it. that's the pitch. no cap, it's just a nice little Perl-y wrapper so you don't have to scream at syscalls directly. π«Ά
π METHODS π
π mask ( IO [, EVENT_MASK ] )
if EVENT_MASK is given, then β and this is the important part β if EVENT_MASK is non-zero, then IO gets added to the list of file descriptors, and the next call to poll will be checking for any event specified in EVENT_MASK. π
if EVENT_MASK is zero, then IO gets removed from the list of file descriptors. bye bestie π
if EVENT_MASK is not given at all? then the return value will just be the current event mask value for IO. a little peek, no changes. π
π poll ( [ TIMEOUT ] )
this calls the system level poll routine. if TIMEOUT isn't specified, heads up, the call will block β like, it will sit there and wait, no thoughts, head empty, until something happens. π
it returns the number of handles which had events happen, or -1 on error. that's the whole return contract, fr fr.
π¦ events ( IO )
returns the event mask which represents the events that happened on IO during the last call to poll. it's giving "receipts from last time." π§
β remove ( IO )
removes IO from the list of file descriptors for the next poll. no more drama for that handle. periodt. π
π handles( [ EVENT_MASK ] )
returns a list of handles.
- if EVENT_MASK is not given, you get a list of all handles known. the whole squad.
- if EVENT_MASK is given, you get a list of handles which had one of the events specified by EVENT_MASK happen during the last call to
poll. only the ones that actually popped off. π₯
π SEE ALSO π
poll(2), IO::Handle, IO::Select
go read those too, bestie, iykyk. π
π AUTHOR π
Graham Barr. currently maintained by the Perl Porters. please report all bugs at <https://github.com/Perl/perl5/issues> β like, actually do it, they want to hear from you. π«Ά
Β©οΈ 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.
and that's the whole page, bestie!! this lil masterpiece is from perl v5.44.0, dated 2026-10-17, and it's page IO::Poll(3perl) of the Perl Programmers Reference Guide. slay, go poll something. πβ¨ππ¦πΈπ π«Ά
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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