Mr. Shawn H. Corey wrote:
I assume your mainline is waiting on input. Like:
while( <> ){
...
}
Yes, that is correct.
If you use alarm, then these waits will be interrupted by the alarm. So
you need a flag to indicate this:
my $alarmed = 0;
sub wakeup {
$alarmed = 1;
# the rest of wakeup
alarm( 600 );
}
...
alarm( 600 );
while( <> ){
if( $alarmed ){
$alarmed = 0;
next;
}
...
}
I get the general intent of your code - and I tried it out without
success - I don't quite understand the two uses of 'alarm' - why does it
need to be in the sub and before the while loop? Also when the wakeup
sub finishes where does the program return to? Also I added a
$SIG{ALRM} to trap the alarm and execute the sub - was that the intent
of your code or is there an easier way of doing it?
My apologies if I seem a little slow on the uptake. :)
Many Thanks
James Turnbull
--
James Turnbull <[EMAIL PROTECTED]>
---
Author of Pro Nagios 2.0
(http://www.amazon.com/gp/product/1590596099/)
Hardening Linux
(http://www.amazon.com/gp/product/1590594444/)
---
PGP Key (http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x0C42DF40)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>