I see what I did wrong..... THANKS.
This seems to work.
in reply to Re: Timeout not working while reading from socket.
in thread Timeout not working while reading from socket.
while (my $line = <$sock>)
if ($line =~ m/^(ALARM: )/)
timeout $nb_secs => sub
$buf .= $sock->getline();
my $msg = MIME::Lite->new(
Data =>$buf ,
print $file $buf;
$line = "";
$buf = "";
print $file $line; #Print current line to open $file.
sleep 10; # allow sometime to exit