in reply to Re: Short example using IPC::Open2 or IPC::Open3
in thread Short example using IPC::Open2 or IPC::Open3

Problem #1: Since the "from child" filehandle is non-blocking, the parent could read from the pipe faster than it fills up, causing @files to contain only a partial list. Since the data is coming from the internet, that's actually quite possible. Why did you make it unblockable anyway? Just exit the loop when sftp> is encountered.

Problem #2: You don't empty the pipe attached to sftp's STDOUT once you've done reading file names, so it could fill up and cause sftp to block.

Replies are listed 'Best First'.
Re^3: Short example using IPC::Open2 or IPC::Open3
by gamache (Friar) on Oct 23, 2007 at 22:15 UTC
    those are better solutions!