Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Timeout not working while reading from socket.

by jrtaylor (Initiate)
on Jan 25, 2013 at 17:14 UTC ( #1015377=note: print w/replies, xml ) Need Help??


in reply to Re: Timeout not working while reading from socket.
in thread Timeout not working while reading from socket.

I see what I did wrong..... THANKS. This seems to work.
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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015377]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2016-12-04 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (61 votes). Check out past polls.