How can I wait in perl? 
Author Message
 How can I wait in perl?

I wan't to execute a subroutine every 5 seconds or so. How can I make perl
wait some time without using something processor killer-stupid like:
sub my_wait {
    my $secs=shift;
    my $tmptime=localtime;
    while ($secs) {
        my $newtime=localtime;
        $secs-- if ($tmptime ne $newtime);
        $tmptime=$newtime;
    }

Quote:
}

--
/jN


Sun, 22 Feb 2004 18:40:18 GMT  
 How can I wait in perl?

Quote:

> I wan't to execute a subroutine every 5 seconds or so. How can I make perl
> wait some time without using something processor killer-stupid like:
> sub my_wait {
>     my $secs=shift;
>     my $tmptime=localtime;
>     while ($secs) {
>         my $newtime=localtime;
>         $secs-- if ($tmptime ne $newtime);
>         $tmptime=$newtime;
>     }
> }

sleep?

jasper
--
      split//,'019617511192'.
      '17011111610114101114'.
      '21011141011840799901'.
            '17101174';
            foreach(0..         # my
            $#_){$_[$_          # signature is too
            ++]^=$_[$_          # bignature
            --]^=$_[$_
]^=$_[++    $_]if!($_%
2)}$g.=$_  ,chr($g)=~
 /(\w)/&&($o.=$1and

      print"$o\n"



Sun, 22 Feb 2004 19:01:19 GMT  
 How can I wait in perl?

Quote:

> > I wan't to execute a subroutine every 5 seconds or so.
<SNIP>

> sleep?

> jasper

Stupid me. But I never learn these commands. I looked in th docs
actually. Both FAQ and builtin functions. Couldn't find it though. I
looked for wait, pause, halt, hold but not sleep! :)


Mon, 23 Feb 2004 14:27:08 GMT  
 How can I wait in perl?

Quote:

>I wan't to execute a subroutine every 5 seconds or so. How can I make perl
>wait some time without using something processor killer-stupid like:

(snip)

perldoc -f sleep

gnari



Mon, 23 Feb 2004 19:06:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. question about canned perl script

2. parsing canned response

3. Troubles with a Canned script

4. canned reply script

5. canned reply??

6. canned replies

7. Can't reach WAIT server when compiling CPAN-WAIT-0.24

8. PERLFUNC: wait - wait for any child process to die

9. PERLFUNC: wait - wait for any child process to die

10. socket question: to wait or not to wait

11. wait function and perl

12. Perl CGI program waiting on exec() problem

 

 
Powered by phpBB® Forum Software