Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^3: IO::Select - reading multiple lines

by zentara (Archbishop)
on Jul 14, 2011 at 19:20 UTC ( #914418=note: print w/ replies, xml ) Need Help??

in reply to Re^2: IO::Select - reading multiple lines
in thread IO::Select - reading multiple lines

is it a very worse idea to use <$fh> to read from a socket

Yeah, you are best off using sysread, and there are a few ways to use sysread, depending on your situation, you can put it in various staement forms

while( sysread $fh, $str, 8192, length $str ) { #or do { $rc = sysread(FH, $buff, 5000000, length($buff)) ; } while ($rc #or if ( sysread( $cli, $buffer, 1024 ) ) {} # etc etc

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Comment on Re^3: IO::Select - reading multiple lines
Download Code
Replies are listed 'Best First'.
Re^4: IO::Select - reading multiple lines
by nagalenoj (Friar) on Jul 15, 2011 at 12:16 UTC
    sysread returns 0, only when the other end exits. Getting into blocking mode, which is not desired. I expect the program to wait in select not in sysread.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://914418]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-11-29 20:49 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (753 votes), past polls