walto has asked for the wisdom of the Perl Monks concerning the following question:
The script must work for Linux and Windows. Start and Stop times have to be accurate. This snippet works for me.use strict; use Time::Hires qw (usleep); my $start = foo my $stop = bar while () { my $now = ParseDate("now"); if ( Date_Cmp( $start, $now ) == 0 ) { start_application; } if ( Date_Cmp( $stop, $now ) <= 0 ) { stop_application; last; } usleep(800000); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Alternatives for "sleepy" while loop
by moritz (Cardinal) on Mar 17, 2008 at 15:18 UTC | |
by pc88mxer (Vicar) on Mar 17, 2008 at 16:57 UTC | |
|
Re: Alternatives for "sleepy" while loop
by chromatic (Archbishop) on Mar 17, 2008 at 17:30 UTC | |
|
Re: Alternatives for "sleepy" while loop
by DACONTI (Scribe) on Mar 18, 2008 at 03:13 UTC | |
by walto (Pilgrim) on Mar 18, 2008 at 04:39 UTC |