in reply to cgi with sleep

Doing this on the server side is unreliable. There may be proxies which defer the transfered output. The browser itself may decide to buffer first. But maybe you can use a nph script? The CGI.pm docs have some information on this topic.

Replies are listed 'Best First'.
Re: Re: cgi with sleep
by ccn (Vicar) on Apr 01, 2004 at 10:20 UTC
    Probably using of javascript is the best choice here, but we can do something on sever side:
    #!/usr/bin/perl use warnings; use strict; $|=1; use CGI qw/:standard/; print header; print "line one<br>\n"; print ' ' x 4096; sleep(3); print "line two<br>\n"; print ' ' x 4096; sleep(3); print "line three<br>\n"; print ' ' x 4096; sleep(3); print "line four\n"; print "<br>\n"; sleep(3);
      This may force flushing output buffers on some proxies. Some proxies maybe need larger padding. Some browsers (notably older ones) always wait until the whole response is received before rendering.