in reply to Timers and timer expire handlers

You want to schedule your script via the cron daemon. It can launch your script at predefined times conveniently. The cron manpage has information on how to do this.

If cron is not available on your system, there is Schedule::Cron, with which you can write your own small implementation of cron to launch your program at specific times. For the expiry timer, set up an alarm handler for $SIG{ALRM}, and prime it with alarm(300) or however many seconds you want to give your program:

eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; $nread = sysread SOCKET, $buffer, $size; alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out } else { # didn't }

Replies are listed 'Best First'.
Re^2: Timers and timer expire handlers
by narashima (Beadle) on Mar 27, 2006 at 22:09 UTC
    Corion, thanks for the reply. However I am running this on Active state perl on Windows NT. Unfortunately my version of Activestate does not support Schedule::cron and cron itself is not available.
    Access to Windows scheduler is disabled at group level.
    Please help.

    Thanks,
    Bhavin
        My version of Active state perl does not show up Schedule::Cron as compatible. Atleast that is what I get when I run ppm.

        The only module that ppm shows me(when I do search Schdule*) is Schedule-Cronchik which has almost no documentation.
        thanks