-
-
15 Dec 2021 22:57:24 UTC
- Distribution: IO-Async
- Module version: 0.801
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (61)
- Testers (1459 / 109 / 0)
- Kwalitee
Bus factor: 1- 82.09% Coverage
- License: perl_5
- Perl: v5.8.4
- Activity
24 month- Tools
- Download (247.35KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Exporter
- File::stat
- Future
- Future::Utils
- IO::Poll
- List::Util
- Socket
- Storable
- Struct::Dumb
- Time::HiRes
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
IO::Async::Timer::Absolute
- event callback at a fixed future timeSYNOPSIS
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
This subclass of IO::Async::Timer implements one-shot events at a fixed time in the future. The object waits for a given timestamp, and invokes its callback at that point in the future.
For a
Timer
object that waits for a delay relative to the time it is started, see instead IO::Async::Timer::Countdown.EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters:
on_expire
Invoked when the timer expires.
PARAMETERS
The following named parameters may be passed to
new
orconfigure
:on_expire => CODE
CODE reference for the
on_expire
event.time => NUM
The epoch time at which the timer will expire.
Once constructed, the timer object will need to be added to the
Loop
before it will work.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.AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
Module Install Instructions
To install IO::Async, copy and paste the appropriate command in to your terminal.
cpanm IO::Async
perl -MCPAN -e shell install IO::Async
For more information on module installation, please visit the detailed CPAN module installation guide.