Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I want to capture the output of a command. I use IO::CaptureOutput. In simple programs, it works fine. As soon as I move it into a program running under CGI.pm 3.42, it does not work. See below for details.
use IO::CaptureOutput qw(qxy); ($output) = qxy(qw(/usr/local/bin/blaaaargh)); say "<blaaaargh failed: $output>";
Expected result:
in the browser<blaaaargh failed: /tmp/blaaaargh: Permission denied >
Actual result:
in the browser<blaaaargh failed: >
in the error_log[Wed Nov 05 16:07:39 2008] [error] [client 127.0.0.1] /tmp/blaaaargh: +Permission denied
I also ran the CGI program from the command line with use CGI qw(:debug) and could verify that the error message comes first on STDERR, then comes the normal output on STDOUT (again, with the error message missing).
What do I do?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capturing output fails under CGI
by MidLifeXis (Monsignor) on Nov 05, 2008 at 16:01 UTC | |
by Fletch (Bishop) on Nov 05, 2008 at 16:14 UTC | |
|
Re: capturing output fails under CGI
by ig (Vicar) on Nov 05, 2008 at 19:50 UTC | |
by Anonymous Monk on Nov 06, 2008 at 19:10 UTC |