IO::As...solute(3pm)
π IO::Async::Timer::Absolute β the group chat manual page π
okay so bestie, this is IO::Async::Timer::Absolute, straight out of the User Contributed Perl Documentation crew. It's giving "wake me up at exactly this moment" energy, and honestly? Iconic. π
β¨ NAME β¨
IO::Async::Timer::Absolute β event callback at a fixed future time π°οΈ
πΈ SYNOPSIS πΈ
Bestie, here's the whole vibe, verbatim, no cap:
use IO::Async::Timer::Absolute;
use POSIX qw( mktime );
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
my @time = gmtime;
my $timer = IO::Async::Timer::Absolute->new(
time => mktime( 0, 0, 0, $time[3]+1, $time[4], $time[5] ),
on_expire => sub {
print "It's midnight\n";
$loop->stop;
},
);
$loop->add( $timer );
$loop->run;
π¦ DESCRIPTION π¦
So this is a subclass of IO::Async::Timer, and what it does is one-shot events at a fixed time in the future. The object literally just sits there waiting for a given timestamp, and then β boom π₯ β it invokes its callback at that point in the future. No cap, that's the whole personality.
But listen, if you want a Timer object that waits for a delay relative to the time it is started instead? That's a whole different bestie. Go see IO::Async::Timer::Countdown instead. π«Ά
π₯ EVENTS π₯
The following events are invoked, either using subclass methods or CODE references in parameters:
π on_expire
Invoked when the timer expires. That's it, that's the moment. β¨
π PARAMETERS π
The following named parameters may be passed to new or configure:
π on_expire => CODE
CODE reference for the on_expire event. Give it a sub and it'll call it when the clock hits. π
β time => NUM
The epoch time at which the timer will expire. Mark the calendar, bestie. π
Once constructed, the timer object will need to be added to the Loop before it will work. Don't forget that step, seriously, it will simply not do anything otherwise. π
Unlike other timers, it does not make sense to start this object, because its expiry time is absolute, and not relative to the time it is started. Like, it already knows when it's going down. Starting it is justβ¦ not the move. π
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the main character who wrote this, periodt. π
friendly reminder: absolute time means absolute. Don't @ me, don't start it, just add it to the loop and let it cook.
And that's the page, bestie!! This little beauty shipped as perl v5.40.1, dated 2026-02-21 β and I fear that is simply the slayest documentation date I've ever seen. Mwah. ππ§
π¦ where this page comes from
- ubuntu stonking: libio-async-perl 0.805-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