while (my $line = <$sock>) { if ($line =~ m/^(ALARM: )/) { timeout $nb_secs => sub { while (2) { $buf .= $sock->getline(); $sock->flush(); } }; if ($@) { my $msg = MIME::Lite->new( ....... Type =>'TEXT', Data =>$buf , ); $msg->send(); print $file $buf; $line = ""; $buf = ""; } } print $file $line; #Print current line to open $file. } } sleep 10; # allow sometime to exit close $file;
In reply to Re^2: Timeout not working while reading from socket.
by jrtaylor
in thread Timeout not working while reading from socket.
by jrtaylor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |