Hi,

Could any one tell me what is wrong with my code? It does not time out after 5 seconds which is what i need. It remains in the infinit loop.

#! /usr/bin/perl 

use strict;
use warnings;

sub comeOut;
$SIG{ALRM} = \&comeOut;

while (1) { };

eval
{
      alarm 5;  #timeout is 60
}

sub comeOut
{
   print "\nGot the signal...Exiting...\n";
   exit;
}

Pls help me...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.