On Wednesday, April 17, 2002, at 09:13 , Chas Owens wrote:
[..]
> The general way to do this in Unix style OSes is to use cron.  Type "man
> crontab" for more info, but it should be possible -- but very
> undesirable -- to write something like this:
[..]
> my $last_run = (localtime)[3];
> until ($terminate) {
>       my ($hour, $today) = (localtime)[2,3];
>       if ($hour = 0 and $last_run < $today) {
>               $last_run = $today;
>               system('script args args');
>       }
> }
[..]

shame on you chas.....

that's a run away script - since you have no throttler
in it at all and it will only 'slow down' while actually
executing your system call.

You clearly would want some sort of

use Time::localtime;

#------------------------------------
# so that we can creep on the time
#
sub sleep_and_peek {
     my ( $hour, $min ) = @_;

     my ( $nowHour, $nowMin $nowSec ) = (localtime->hour , localtime->min, 
localtime->sec);

     if ( $nowHour > $hour ) {
         print "come back tomorrow\n";

     } elsif ( ($hour - $nowHour ) > 1 ) {
         print " wait at least " . ( $hour - $nowHour - 1) . " hours\n";
     } else {
         print "Inside of an Hour\n";
         my $minOff = 60 - $nowMin ;
         print "so sleep at least $minOff minutes \n";
     }
}

to allow you to creep up on the Puppy with a sleep....
rather than trying to thrash the system.......

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to