Rodster001 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I have a cgi which I am converting to run under mod_perl as an apache handler. It creates (sometimes quite) large zip files on the fly and prints the stream to STDOUT. Currently it uses Archive::Zip::SimpleZip in this pseudo-code way:
print "Content-Disposition: attachment; filename=\"myarchive.zip\"\n\n +"; my $z = new Archive::Zip::SimpleZip '-', Stream => 1; my $fh = $z->openMember(Name => "myarchive.zip"); print $fh <binary data here>; close($fh); $z->close();
This works fine as a cgi. But I am having a little trouble porting this to mod_perl. I am thinking that if I turn off buffered output $| = 1 and then get Archive::Zip::SimpleZip to stream to Apache2::RequestIO::print() this will work. But I am not sure how to "select" Apache2::RequestIO::print().

Or maybe that is going about it the wrong way. Any help is appreciated.

Replies are listed 'Best First'.
Re: Printing a stream to STDOUT under mod_perl
by beech (Parson) on Mar 15, 2017 at 23:30 UTC
      I have. But this won't work for my needs.