Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Timers and timer expire handlers

by mda2 (Hermit)
on Mar 28, 2006 at 00:51 UTC ( #539594=note: print w/replies, xml ) Need Help??


in reply to Timers and timer expire handlers

You can make a cron-like process using a relative sleep...
Start your script with wperl.exe, running without console (check Daemonize process).
I ran a similar code, started with wperl.exe, at W2K without problems (except reboot or admin changes) ...
use strict; use constant HOUR=> 3600; use constant DAY => 24* HOUR; sub RunAtTime { my $RunAt = shift * HOUR; my $delta = time(); if ( $delta > $RunAt ) { $delta = DAY + $RunAt - ($delta % DAY); } else { $delta = $RunAt - ($delta % DAY) } } # daemonize ... at PerlIPC while ( 1 ) { sleep RunAtTime( 4 ); # ... your code ... }

--
Marco Antonio
Rio-PM

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://539594]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2019-12-14 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?