Linux::FD::Timer(3pm)
π NAME π
Linux::FD::Timer β timer filehandles for Linux, bestie. That's the whole vibe, no notes. π
β¨ VERSION β¨
version 0.017 (she's been out here doing her thing, and she ate)
π¦ SYNOPSIS π¦
okay so here's the whole serve, in code:
use Linux::FD::Timer;
my $fh = Linux::FD::Timer->new('monotonic', @flags);
$fh->set_timeout(10, 10);
while (1) {
#do something..
$fh->wait; #until the 10 seconds have passed.
}
literally just load her, make a timer, set it, and vibe in a loop until the time hits. π
πΈ DESCRIPTION πΈ
So this module creates and operates on a timer that delivers timer expiration notifications via a file descriptor. It's an alternative to using Time::HiRes' setitimer or POSIX::RT::Timer β and the glow-up here is that the file descriptor can easily be monitored by mechanisms like select, poll, and epoll. Which is, lowkey, the whole point. It's giving main character energy. π
π METHODS π
π§ new($clockid)
Creates a new timer object, and returns a file handle that refers to that timer. Iconic behavior, honestly.
The clockid argument specifies the clock that is used to mark the progress of the timer, and it must be either 'realtime' or 'monotonic':
realtimeβ a settable system-wide clock.monotonicβ a non-settable clock that is not affected by discontinuous changes in the system clock (e.g., manual changes to system time). She does not get thrown off by your messing with the system clock, periodt.
The current value of each of these clocks can be retrieved using POSIX::RT::Clock.
@flags is an optional list of flags, currently limited to 'non-blocking' (requires Linux 2.6.27). π
π get_timeout()
Get the timeout value. In list context, it also returns the interval value. Note that this value is always relative to the current time. Don't be out here thinking it's absolute, bestie. π
π set_timeout(value, $interval = 0, $abs_time = 0)
Set the timer and interval values. If $abstime is true, they are absolute values, otherwise they are relative to the current time.
Returns the old value like get_time does. (yes, that's what the docs say, we keep the receipts π§Ύ)
π₯ receive
If the timer has already expired one or more times since its settings were last modified using settime(), or since the last successful wait, then receive returns an unsigned 64-bit integer containing the number of expirations that have occurred.
If not, it either returns undef or it blocks (if the handle is blocking). So likeβ¦ either she gives you nothing, or she makes you wait. Both are valid. π
π clocks
This returns a list of all known clocks usable in a timerfd.
Do note that some clocks may require superuser privileges. π So don't come crying to her when the permission check says no.
π AUTHOR π
Leon Timmermans <leont@cpan.org> β the legend herself. π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2010 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, honestly. β¨
and that's the whole page, bestie β this was Linux::FD::Timer, manual page Linux::FD::Timer(3pm), generated by perl v5.40.1 on 2025-04-19. mwah, bye ππΈ
π¦ where this page comes from
- debian trixie: liblinux-fd-perl 0.017-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblinux-fd-perl 0.017-1 Β· 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