FYI
There's a bug in the Perl 5.8.2 version of IPC:

pen3
as discussed at
http://www.nntp.perl.org/group/perl.perl5.porters/2006/05/msg113368.htmlTeamSite:

ys::run() is a wrapper on Open3, and suffers the same problem.
summaryexecuting IPC:

pen3 in an eval can cause the rest of the script to be executed 2x if the child process fails to exec. There's also a problem with END blocks.
DetailsWhat happens is, Open3 forks, and then exec's the command. If the exec fails, the Open3 function dies. But because the whole thing is in an eval block (inherited from the parent when the process forked), the child lives on to execute the catch (if $
@) + the rest of the code intended for the parent, which is bad. Finally, the child comes to an end when it has executed the rest of the parent's code, and then returns from Open3.
Note: the only reason that I found so far for exec to fail, is when the command is non-existant. That's a little comforting, because it's unlikely to happen (unless I missed other reasons)
but it gets worse if we add an END block to our code, because eval or not, the child will execute it, and that's no good either.
iw-perl = perl 5.8.2. I've noticed that perl 5.10.0 has a fix for this, with a newer IPC:

pen3 (which forces an immediate child exit if exec fails). I've built a simple demo script for this issue, and that code with the newer Open3 works correctly.
Note: Open2 is a wrapper around Open3, so it has the same problem.
consider yourself warned (I had to find out the hard way)