msalerno has asked for the wisdom of the Perl Monks concerning the following question:
According to Archive/Zip.pm:
Here's an example script:use constant COMPRESSION_DEFLATED => 8; # file is Deflat +ed use constant COMPRESSION_LEVEL_DEFAULT => -1; use constant COMPRESSION_LEVEL_FASTEST => 1; use constant COMPRESSION_LEVEL_BEST_COMPRESSION => 9;
Expected output:#!/bin/perl -w use strict; use Archive::Zip qw(:ERROR_CODES :CONSTANTS); #$VERSION = '1.30'; die "usage: $0 zipfile.zip file [...]\n" if (scalar(@ARGV) < 2); my $zipName = shift(@ARGV); my $zip = Archive::Zip->new(); foreach my $memberName (map { glob } @ARGV){ my $member = $zip->addFile( $memberName ) or warn "Can't add file $memberName\n"; #$member->desiredCompressionMethod( COMPRESSION_DEFLATED ); $member->desiredCompressionLevel( 9 ); } my $status = $zip->writeToFileNamed($zipName); my $zipread = Archive::Zip->new(); $zipread->read( $zipName ); foreach my $member ($zipread->members()){ print $member->fileName()."\t", $member->compressionMethod()."\t", $member->desiredCompressionMethod()."\n"; } exit $status;
Actual output:
filename.log 8 8
Thanks for the help
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Archive::Zip not honoring desiredCompressionMethod
by spazm (Monk) on Jul 08, 2009 at 18:36 UTC |