Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with $SIG{ALRM}

Status
Not open for further replies.

tjlst15

IS-IT--Management
Mar 20, 2002
15
0
0
US
When using Perl 4.0 under HP-UX 11, $SIG{ALRM} is not working. Here is a chunk of code:

$timeout = 10;
$SIG{INT} = 'wrapup';
$SIG{TERM} = 'wrapup';
$SIG{ALRM} = 'timeout';
alarm $timeout;
print ROOTLOG "Before while loop - timeout length=$timeout\n";
$i = 1;
while ($i < 20) {
sleep 2;
print ROOTLOG &quot;Inside while loop: call $i\n&quot;;
&flush(ROOTLOG);
$i++;
}


Now, what should happen here is the loop should go for 10 iterations and then SIG{ALRM} should break the code and go to the 'timeout' subroutine. The alarm is never sent and the loop finishes after 20 iterations. Has anyone else had any problems with SIG{ALRM}?

Thanks
 
Perl 4? <smile> go get Perl 5....



Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top