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 (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