Hi Sam,
Did you made some additional tuning your script or your web server to avoid a buffering? I've tried
repeat your example. When I started it from console, it works ok; it prints incremental result step by step.
But when I started it from browser, it still waits and returns result all as whole.
#!perl -w # # file test1.pl # use strict; use Test1_App; Test1_App->new()->run();
# # file Test1_App.pm # package Test1_App; use strict; use base 'CGI::Application';
sub setup {
my $self = shift;
$self->start_mode('mode_slow');
$self->run_modes(mode_slow => 'mode_slow');
}sub mode_slow {
my $self = shift;
my $query = $self->query; $self->header_type('none');
$| = 1;
print $query->header(-expires => '-1d'); for(my $i=0; $i<=10; $i++) {
print "$i ";
sleep 1;
}return ""; }
1;
Alex
The easy way to do this is to tell CGI::App to not print a header and then just print the increment results yourself. I've used this to produce a progress bar from within a CGI::App runmode. Something like:
sub slow_mode { my $self = shift; my $query = $self->query;
# setup for increment output $self->header_type('none');
# print our own header and output print $query->header(-expires => '-1d'); print "SOME OUTPUT\n";
# return nothing at the end return ""; }
-sam
--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
