#!/usr/bin/perl use strict; my $r = Apache->request; # mod_perl 1 print "Content-type: text/html\n\n"; print "
"; print "START\n"; $r->rflush; sleep 5; print "End\n"; print "\n"; ####
my $my_print = sub {
print @_;
$r->rflush;
};
# call it like this
$my_print->("....");
####
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Ex;
my $cgix = CGI::Ex->new;
my $my_flush;
if (! $cgix->mod_perl_version) {
$| = 1;
$my_flush = sub {}; # no op
} else {
$my_flush = sub {
# works on most apache versions
$cgix->apache_request->rflush;
};
}
$cgix->print_content_type;
print "...\n";
$my_flush->();
sleep 5;
print "The rest...\n";