#! /usr/bin/perl -w # # Server-side "slow load" script # # Passes data tokens to the browser, but at it's own rate. # The connection is left open, so any time the server has # data it can immediately flush it. # # Example by Bryce Nesbitt, Obviously Enterprises # use CGI; my $seqnum = CGI::param('seqnum'); $seqnum++; my @colors= ( "red", "purple", "gold", "yellow", "green", "lime" ); my $index = rand() * scalar @colors; print STDERR "Sleeping random ammount\n"; sleep(rand() * 10 + 5); print STDERR "Setting power plant status to $colors[$seqnum]\n"; print qq"Content-type: text/html\n"; print qq"Cache-Control: max-age=0\n"; print qq(
In real applications, this loader frame will have zero size.