Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: IO::Handle->getline() partial reads from pipe

by choroba (Archbishop)
on Dec 18, 2013 at 22:38 UTC ( #1067735=note: print w/replies, xml ) Need Help??

in reply to IO::Handle->getline() partial reads from pipe

Buffered IO does not work with sockets, maybe pipes are a similar beast? I was having similar problems in A Game Using TCP Sockets.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re: IO::Handle->getline() partial reads from pipe

Replies are listed 'Best First'.
Re^2: IO::Handle->getline() partial reads from pipe
by andal (Hermit) on Dec 19, 2013 at 11:00 UTC

    Well, buffered IO does work with sockets, you just have to take into account all of the corners of such use :)

    In this particular case one must actually see the code and analyze the data flow, using for example strace. In simple tests, the getline works correctly with pipes. It blocks waiting for EOF or for next "\n". It returns not earlier than obtaining either of those. Completely different story happens when the reading end of pipe is in "non-blocking" mode. Here getline may produce incomplete lines and in general reading would require a lot of care.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2021-01-26 23:39 GMT
Find Nodes?
    Voting Booth?