1IO::Async::Timer(3) User Contributed Perl Documentation IO::Async::Timer(3)
2
3
4
6 "IO::Async::Timer" - base class for Notifiers that use timed delays
7
9 This module provides a subclass of IO::Async::Notifier for implementing
10 notifiers that use timed delays. For specific implementations, see one
11 of the subclasses:
12
13 • IO::Async::Timer::Absolute - event callback at a fixed future
14 time
15
16 • IO::Async::Timer::Countdown - event callback after a fixed
17 delay
18
19 • IO::Async::Timer::Periodic - event callback at regular
20 intervals
21
23 new
24 $timer = IO::Async::Timer->new( %args )
25
26 Constructs a particular subclass of "IO::Async::Timer" object, and
27 returns it. This constructor is provided for backward compatibility to
28 older code which doesn't use the subclasses. New code should directly
29 construct a subclass instead.
30
31 mode => STRING
32 The type of timer to create. Currently the only allowed mode is
33 "countdown" but more types may be added in the future.
34
35 Once constructed, the "Timer" will need to be added to the "Loop"
36 before it will work. It will also need to be started by the "start"
37 method.
38
40 is_running
41 $running = $timer->is_running
42
43 Returns true if the Timer has been started, and has not yet expired, or
44 been stopped.
45
46 start
47 $timer->start
48
49 Starts the Timer. Throws an error if it was already running.
50
51 If the Timer is not yet in a Loop, the actual start will be deferred
52 until it is added. Once added, it will be running, and will expire at
53 the given duration after the time it was added.
54
55 As a convenience, $timer is returned. This may be useful for starting
56 timers at construction time:
57
58 $loop->add( IO::Async::Timer->new( ... )->start );
59
60 stop
61 $timer->stop
62
63 Stops the Timer if it is running. If it has not yet been added to the
64 "Loop" but there is a start pending, this will cancel it.
65
67 Paul Evans <leonerd@leonerd.org.uk>
68
69
70
71perl v5.34.0 2021-08-08 IO::Async::Timer(3)