http://qs321.pair.com?node_id=1067782


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

I used to know something about pipes, but that was a long time ago. At the kernel level a pipe as a maximum size (once upon a time I think 16K may have been typical). If you writes are larger than that then at the system level the child may get at most that max amount. I would think that getline() should buffer the read and read again until it reads data with an newline. It sounds like this isn't happening in your case. I'd expect that kind of behaviour from sysread(), but not getline().

I'm curious if the long line is split between getline() calls. If it was you could check if the returned line was newline terminated. If it wasn't terminated then call getline() again and concatenate the data yourself. (I know this is UGLY.)

You might also see if flushing the write side makes any difference. I wouldn't expect it to help but it may be worth a try.

I am ASSUMING that your situation is as simple as described---a single parent writes and a single child reads, no other interaction between the two processes.