APM: cgi::application and response buffering?

Sam Foster austin.pm at sam-i-am.com
Fri Apr 29 09:15:02 PDT 2005


I've got a little cgi that uses CGI::Application.
Its primary job is building and delivering zip files from a filelist.

I'd like to show the user progress on what files are being added as the 
script runs (as I some of the zip files will be many MB of data). Im 
looking for an option or way to turn off response buffering and start 
printing out content as it arrives but CGI::Application seems to 
preclude this? The work is done in my runmode subroutine, but headers 
etc. don't get sent until much later.

... from CGI::Application::run()

     # Call cgiapp_postrun() hook
     $self->cgiapp_postrun($bodyref);

	# Set up HTTP headers
	my $headers = $self->_send_headers();

	# Build up total output
	my $output  = $headers.$$bodyref;


	# Send output to browser (unless we're in serious debug mode!)
	unless ($ENV{CGI_APP_RETURN_ONLY}) {
		print $output;
	}

Any ideas?

thanks,
Sam



More information about the Austin mailing list