Hi Monks,
I am re-asking this question (which I posted about a year ago, here
https://www.perlmonks.org/?node_id=1184785) because I have yet to find an answer.
The goal is to create a zip file and stream it to the client (via the web) as it is built (the file is quite large).
The solution, offered in my last post was to use ModPerl::Registry and run it as a cgi, but that is not the route I want/need to go. Instead I am trying to get this to work with Apache2::RequestRec and Apache2::IO and run it as a module... if possible.
The block of code below streams a zip file to STDOUT, which obviously will not work (unmodified) in this case as STDOUT is tied to the Apache request object. So, I am hoping to find a workaround.
my $z = new Archive::Zip::SimpleZip '-', Stream => 1;
foreach my $file (@many_files) {
open (my $fh, $file);
$z->addFileHandle($fh, Name => $file);
close($fh);
}
$z->close();
Any help would be greatly appreciated.