in reply to How to be a child of IPC::Run?

I can't understand how your code works, with @cat, but my first thought is use a pipe instead of trying to link programs thru reading stdin. Look at pipes with Proc::Fork for example.

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

Replies are listed 'Best First'.
Re^2: How to be a child of IPC::Run?
by cwood (Initiate) on Apr 30, 2012 at 14:06 UTC
    It's not my code, it's from the IPC::Run example. Thank you for the pointer, though. I will look into that.
      Responding to my own post is so awfully tacky, but if I add this before my for loop in wr2, my example works:
      $| = 1;
      Now I'll see if I can figure out the rest.

        Finally, I kept getting "process ended prematurely at /home/cwood/bin/pr2 line 46" in my more involved work elsewhere. I printed the parent's output (child's input) at the parent, and that helped me discover a stray "exit 0" leftover from when my child was a script forked with each execution.

        Similarly a "print 123" without the "\n" would have caused an apparent IPC freeze if I was checking for /\n/ in the parent's input (child's output).

        So two answers:

        1. unbuffered output on the child
        2. watch for leftovers from previous techniques on parent and child