advait has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: How to avoid browser time out?
by merlyn (Sage) on Oct 31, 2007 at 21:11 UTC
Re: How to avoid browser time out?
by hangon (Deacon) on Oct 31, 2007 at 21:05 UTC

    Just print something back to the browser periodically while your script is running. Anything will do, even a single character. If you don't need feedback during the computation, use a single space so it will not occupy real estate in the browser window.

    ... code $| = 1; # set autoflush print "Content-type: text/html\n\n"; # simulate long running computation: for (1..3600){ sleep 1; # or do some processing # sends a single space to browser every 10 seconds unless ($_ % 10){ print ' ' } } ... more code

    Update: Set autoflush before doing this.

Re: How to avoid browser time out?
by ForgotPasswordAgain (Vicar) on Oct 31, 2007 at 16:57 UTC

    On the apache server, configure Timeout to be longer.

    Client-side is up to the client I guess. In Firefox, go into about:config and filter on "timeout".

A reply falls below the community's threshold of quality. You may see it by logging in.