Nix Juban wrote:
> i want to insert this script in one of my programs appearing like its
> processing or doing something..since my loop is while(1), meaning always
> true, it will run forever until i halt it.
> 1)How do I time it to run for only few seconds?
> 2) What if im really processing something like extracting data through ftp
> and parsing it, how do i run this while its doing all that?
>
try the alarm function along with $SIG{ALRM}. example:
#!/usr/bin/perl -w
use strict;
$SIG{ALRM} = sub { die "see ya\n" };
alarm(2);
while(1){
print time,"\n";
}
__END__
the above will end in about 2 seconds. check:
perldoc -f alarm
for more. HTH
david
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]