in reply to Re^2: Networking without a network
in thread Networking without a network
Some commonly tried approaches are usually attempted. First try a sysread instead of <> on $reader, and use IO::Select to detect data in the pipeline.
#pseudocode my $data while ($select->can_read){ if ( (my $length = sysread $reader, $data, 4096) > 0) { # do something with $data } }
You might also want to test out a different IPC module, which may work better than IPC2. See I got IPC::Open3 to work! and Script hangs when called via IPC::Open3 and IPC3 buffer limit problem and Script hangs when called via IPC::Open3 for example.
The IPC3 links above have code showing how to combine IO::Select with sysread....... that is your best first shot. The basic idea should work with IPC2 also. The last resort, if select and sysread fail, is to use a pty, like in Re: monitoring memory load.
We really need to know what this program does. What does it expect on input, and what output does it deliver? Somehow, your data just sits in the pipeline buffer. You might also try the Expect module.
|
|---|