in reply to Re^2: Background process with perl and lighttpd
in thread Background process with perl and lighttpd

flushing the output does not work...

The only thing that works is closing STDIN, STDOUT and STDERR. But then the script stops!

This is what I have:

my $q = new CGI; my $session = CGI::Session->load($q); my $tmpfile = $q->upload('upfile'); my $filename = $q->param('upfile'); print $q->redirect('showProgress.cgi'); close STDOUT; close STDIN; close STDERR; # <-- script stops here! append_file( 'debug', "start\n" );

Replies are listed 'Best First'.
Re^4: Background process with perl and lighttpd
by Anonymous Monk on Jun 03, 2010 at 12:31 UTC

      Thx alot, this helped!

      What is this for?

      unless (open F, "-|") { open STDERR, ">&=1"; }
        We'll do this with a pipe-open which includes an implicit fork, in line 37. The grandchild process merges STDERR to STDOUT, and then executes traceroute, passing it the validated host parameter from before.
        Also, perldoc -f open