in reply to Re: Asynchronously capturing output from an external program
in thread Asynchronously capturing output from an external program

File handle worked just fine. ...now I'm trying to get the output back out of it. Now I'm hanging when I try to extract the output from the handle. My code looks like:
print "\n PROCESSING \n\n"; while (<$fh>) { print "$_ \n"; if($_ =~ m/"urlid":"(.*?)"/) { print "found it! \n"; $target = $1; print "terminating \n"; last; } }
I get "Processing" and then the first line from the output before it just hangs. I'm not entirely sure what's going on there. I'll try messing around with Expect and see if I can get that to work.

Replies are listed 'Best First'.
Re^3: Asynchronously capturing output from an external program
by ikegami (Patriarch) on Nov 09, 2010 at 21:35 UTC

    I get "Processing" and then the first line from the output before it just hangs

    So it's waiting to receive a newline from the child. The child hasn't sent one at all, or it's waiting in a buffer the child hasn't flushed.