How can I run a system command and die if anything is written to STDERR?
问题 I'm writing a Perl script which uses an external script. The external script must run from a specific directory so I found the following useful: use IPC::System::Simple qw(capture); my @args = ('external script path...', 'arg1', ...); my $out = capture( [0], "cd $dir ; @args" ); Sometimes the external script writes stuff to STDERR but still returns 0. I wish to capture these times and confess (or die ). Since I don't control the return value of the external script, I thought maybe I could