Home > Archive > PERL Miscellaneous > July 2005 > Timer/alarm clock module
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Timer/alarm clock module
|
|
| Ignoramus27279 2005-07-29, 5:03 pm |
| Is there some perl module for setting alarms? The use I have in mind
is as follows:
my $times = new AlarmModule( 600, sub { print "Hello" } );
that would make the timer wake up every 600 seconds and print hello.
Any suggestions?
i
| |
|
|
| HaroldWho 2005-07-29, 5:03 pm |
| On Fri, 29 Jul 2005 18:53:21 GMT, Ignoramus27279 wrote in comp.lang.perl.misc:
> Is there some perl module for setting alarms? The use I have in mind
> is as follows:
>
> my $times = new AlarmModule( 600, sub { print "Hello" } );
>
> that would make the timer wake up every 600 seconds and print hello.
>
> Any suggestions?
See the Time::HiRes module pod.
HTH,
HW
--
Powered by SuSE Linux 9.0 -- Kernel 2.6.11
News Reader slrn 0.9.8.1
| |
| Ignoramus27279 2005-07-29, 5:03 pm |
| On Fri, 29 Jul 2005 19:06:09 -0000, HaroldWho <hlarons@yahoo.com> wrote:
> On Fri, 29 Jul 2005 18:53:21 GMT, Ignoramus27279 wrote in comp.lang.perl.misc:
>
> See the Time::HiRes module pod.
>
Thanks, I was looking for something object oriented that hides
$SIG{ALRM} and such.
i
| |
| Tassilo v. Parseval 2005-07-30, 4:00 am |
| Also sprach Ignoramus27279:
> Is there some perl module for setting alarms? The use I have in mind
> is as follows:
>
> my $times = new AlarmModule( 600, sub { print "Hello" } );
>
> that would make the timer wake up every 600 seconds and print hello.
>
> Any suggestions?
You could use Event::Lib although it might be a bit oversized for that
kind of task:
use Event::Lib;
$| = 1;
my $timer = timer_new(
sub {
my $event = shift;
print "Hello";
$event->add(600); # re-schedule
}
);
$timer->add(600);
$timer->dispatch;
Tassilo
--
use bigint;
$n=7142335034377028016139702633033737113
9054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
|
|
|
|
|