in reply to IPC:Open2 question
I've encountered similar situations when playing around with IPC. It sounds to me like you need to somehow "flush" the pipe which IPC2 sets up for <README>. I'm no expert, I usually just "hack at it" until I get results. As a guess, I would say the local $/ = undef; statement may be interfering with IPC2 's ability to detect a newline? (which signals a pipe flush?)
I know with sockets, earlier version of IO::Socket did not have autoflushing turned on, and you needed to manually issue a $sock->flush to avoid the problem you describe.
If the program you are running is a perl script, you should be able to make it flush, but if it's not a script...then you may have to get "low-level" with it.
You can "suck data" out of the pipe, if you know how much data is waiting in the pipe Read "perldoc -q filehandle" there is a section on it:
So you can keep running this test, and when $size > 0, you can use sysread to grab a $size chunk out of the filehandle.#read man h2ph if you don't have sys/ioctl.ph require 'sys/ioctl.ph'; $size = pack("L", 0); ioctl(FH, FIONREAD(), $size) or die "Couldn't call ioctl +: $!\n"; $size = unpack("L", $size);
|
|---|