Allegro::Timer - Allegro Timer routines
use Allegro; sub callback { $i++; } $al = Allegro->new or die; $timer = $al->Timer(code => \&callback, interval => 0.10); while($i > 0) { print "timer was called\n"; $timer->poll; }
Allegro::Timer provides an object-oriented interface to the Allegro timer related routines.
A timer object, after created will call its callback function at a certain interval until stopped.
Currently, Timers must be polled for the callback function to be called. A thread-based or SIGALRM-based Timer implementation may be included in the future. See poll below.
Creates a new timer object. Returns an Allegro::Timer object on success, or undef on error.
$timer = $al->Timer(code => \&callback, interval => 1.0, param => $param, defer => 0);
Code reference to be called every after every interval seconds.
Time (in seconds) between each timer callback.
Single parameter to be passed to callback function.
If this is set, the timer will not start until the start method is called. Not set by default.
This method must be called continously to call the code specified by new.
Starts the timer. This will usually be called on timer creation unless you specify to not start the timer.
Stops the timer. The timer may be started again with another call to start.
Colin O'Leary <colino@cpan.org>
Copyright 2003 by Colin O'Leary. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The Allegro library is copyright its authors, and is giftware. See http://alleg.sf.net for more information.
To install Allegro, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Allegro
CPAN shell
perl -MCPAN -e shell install Allegro
For more information on module installation, please visit the detailed CPAN module installation guide.