Greetings! I am using IO::Compress::Zip but I cannot get the syntax quite right for what I am trying to do. Here is some pseudo code:
use IO::Compress::Zip qw(zip $ZipError); my $zip = new IO::Compress::Zip \*STDOUT or print STDERR "IO::Compress::Zip failed: $ZipError\n"; foreach my $file (@files) { ... do some stuff to the file ... now add file to the archive } $zip->close;
My problem: Using this the OO way I am not quite sure how to define the filename AND the contents of the file on each loop thus producing a stream to STDOUT with multiple files.
UPDATE
I ended up using Archive::Zip::SimpleZip. This seems to work good and does in fact stream the zip file from the server as it is being processed.
## when using '-', Stream is set to 1 my $z = new Archive::Zip::SimpleZip '-', or print STDERR "Cannot create zip file: $SimpleZipError\n"; foreach my $file (@files) { ... do some stuff to the file my $fh = $z->openMember(Name => "<filename.ext>"); print $fh <stuff>; close($fh); } $z->close;
In reply to Multi file stream with IO::Compress::Zip by Rodster001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |