I’m using HTTP::Server::Simple::CGI to write a simple webserver. Within my handler, I have to run a process that prints something to STDOUT. I want the STDOUT redirected to the client and not to the console.
This is my handler
sub serve_content {
$| = undef;
my $cgi = shift;
print $cgi->header('image/png');
IPC::Run::run ['/usr/bin/myapp', '-o', '/dev/fd/3'], '3>&1', '1>&2', '>', *STDOUT;
}
This prints the output of the app to the console, not to client who made the http request. How do I redirect it?
Order of redirections matter. Redirecting 3 to 1 and 1 to 2, efectivelly redirects 3 to 2. Try:
Or may be