I have a question concerning the proper behavior of rflush() with mp1. I'm
using Apache/1.3.28 and mod_perl/1.28 on OSX jaguar 10.2.6. Overall mp1
appears to work great. However, the following code does not work as
expected:

use CGI ();
my $r = shift;
my $q = new CGI;
print $q->header('text/html');
print $q->start_html;

print $q->p("Searching...Please wait");

$r->rflush;
# imitate a lengthy operation
for (1..3) {
  sleep 1;
}
print $q->p("Done!");

The "Searching...Please wait" text does not display until the sleeps are
done. Adding $|=1; up top does not help. However, this code does work:

use CGI ();
my $r = shift;
my $q = new CGI;
print $q->header('text/html');
print $q->start_html;
for (1..263)
{
    print $q->p("Searching...Please wait");
}
$r->rflush;
# imitate a lengthy operation
for (1..3) {
  sleep 1;
}
print $q->p("Done!");

It appears that if I print out over 8k, the buffers flush. Less than that,
no flush. Is this proper behavior? And, if so, is there a parameter I can
change somewhere to lower the value or force a flush regardless of what's in
the buffer? I have tried very hard to find documentation or previous
discussion in this group to no avail.

Douglas

Reply via email to