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