Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Background process with perl and lighttpd

by jau (Hermit)
on Jun 02, 2010 at 16:14 UTC ( #842789=note: print w/replies, xml ) Need Help??

in reply to Background process with perl and lighttpd

The problem is, that lighttpd buffers all output until all process terminate.

Have you tried to flush the output stream?

This should do the trick:

sub flush { my $fh = select( STDOUT ); my $hot = $|; $| = 1; print STDOUT ''; $| = $hot; select( $fh ); return; }

Replies are listed 'Best First'.
Re^2: Background process with perl and lighttpd
by zwon (Abbot) on Jun 02, 2010 at 19:46 UTC

      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" );

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://842789]
[MidLifeXis]: Is there internet access up there on the lakes? If I moved there I would like to be able to fish :-D
[LanX]: Not Quite Canada
[Discipulus]: have you been fired?!?
[LanX]: remote rules, I've been offered jobs in the US with the promise to stay outside
[MidLifeXis]: Nope. Just looking around, as there are multiple culture and business changes in the area I am in.
[MidLifeXis]: not yet, anyway. Who knows. Just do my best and whatever happens happens.
[LanX]: should be even easier for you
[Discipulus]: oh well we cant afford two monks fired in a day!
[LanX]: any news from tye ' s search?
[MidLifeXis]: Ugh - who else?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2017-03-23 12:40 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (286 votes). Check out past polls.