Rodster001 has asked for the wisdom of the Perl Monks concerning the following question:
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multi file stream with IO::Compress::Zip
by NetWallah (Canon) on Sep 17, 2014 at 05:03 UTC | |
by Rodster001 (Pilgrim) on Sep 17, 2014 at 05:06 UTC | |
by pmqs (Friar) on Sep 17, 2014 at 09:40 UTC | |
by Rodster001 (Pilgrim) on Sep 17, 2014 at 16:36 UTC | |
|
Re: Multi file stream with IO::Compress::Zip
by Rozman (Initiate) on Sep 22, 2017 at 06:00 UTC |