#!/usr/local/bin/perl
use CGI;
$query = new CGI;
&print_push_header($query);
# very important to unbuffer output for server push!
while (1) {
$time = `/bin/date`;
$document=join("\n",
$query->start_html("Tick Tock"),
"
",
"$time
",
$query->end_html);
&update_page($document,'text/html');
sleep(1);
}
sub print_push_header {
my($query) = @_;
# Very important to unbuffer output
# for server push!
$|=1;
# This is a global
$BOUNDARY = "---------ready-or-not-here-it-comes!";
print $query->header(-status=>"200 OK",
-server=>"$ENV{SERVER_SOFTWARE} / Lincoln's Script",
-type=>"multipart/x-mixed-replace; boundary=$BOUNDARY");
}
sub update_page {
my($page,$type) = @_;
print <