#!/usr/bin/perl # non-buffered.cgi - This will test the HTMLObject Base object in nonBuffer Mode# and in buffered mode in the same script. use HTMLObject::Base; use HTMLObject::CGILib; use strict; #use cgi_lib; use vars '%input'; %input = (); #cgi_lib::ReadParse(*input); HTMLObject::CGILib::ReadParse(*input); my $command = $input{command}; my $doc = HTMLObject::Base->new(); $doc->setCookie(name=>'testing', value => "non-buffered.cgi"); if ($command eq "test") # display the non-buffered test page { $doc->setTitle("non-Buffered Test Page"); $doc->setFocus("body"); $doc->print("

This is the non-Buffered test page.

\n"); $doc->print("I am going to loop 10 times where I sleep for the current loops amount of time:
1 second, 2 seconds, etc. upto 10 seconds.
After each sleep I will display a message.
\n"); $doc->print("I am going into non-Buffering mode now!


\n"); $doc->startDisplaying; #$doc->setFocus("body"); # This should bomb out. for (my $i=1; $i <= 10; $i++) { sleep $i; $doc->print("$i seconds have now gone by.
\n"); } $doc->print("Return to main page\n"); $doc->endDisplaying; } else # display the start page (buffered mode) { $doc->setTitle("Buffered Test Page"); $doc->setFocus("body"); $doc->print("

This is the Buffered test page.

\n"); $doc->print("Run non-Buffered test\n"); $doc->display(); } exit 0;