cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
What I'm confused about is what goes in the zip case. The docs say you can change the compression for any element with the desiredCompressionLevel method, but you have to know the member name first. But isn't the file member compressed when you add it? If so this would not help me avoid the cycles to compress it only to uncompress it with the desiredCompressionLevel method, in fact it would make things worse.use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use File::Find qw(find); my $startdir = 'foo'; our $zip = Archive::Zip->new(); my $dir_member = $zip->addDirectory( '04campaigndashboard/' ); $dir_member->desiredCompressionLevel( 9 ); find(\&wanted,$startdir); sub wanted { ($fn = $File::Find::name) =~ s/$startdir//; if ($fn =~ /.zip/) { ???? } else { my $file_member = $zip->addFile( $fn ); } return; }
Or is the compression done when the archive is written to disk?
UPDATE: I was just doing some testing and found tat the addFile method seems to not work when the argument is a zip file--it returns undef. So maybe you can't nest zip files with this mod at all>
TIA....Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Archive::Zip changing compression on the fly
by zwon (Abbot) on May 22, 2010 at 15:42 UTC | |
by cormanaz (Deacon) on May 22, 2010 at 16:12 UTC | |
by zwon (Abbot) on May 22, 2010 at 16:32 UTC | |
by afoken (Chancellor) on May 23, 2010 at 06:23 UTC | |
by Anonymous Monk on May 23, 2010 at 10:07 UTC |