After analysing fewArchive::Zip does not (for some reason) set the bits of General Purpose Bit Flag.
This means that
Let us reproduce it by creating twohello-zip.zip (created with the GNU/Linux zip utility) and hello-az.zip created with Archive::Zip for comparison. Both the files contain:
Filename: hello
Content:
Hello world.
Hello world.
Hello world
Let us compress:
[alanhaggai@archer zip]$ zip -9 hello-zip.zip hello
adding: hello (deflated 54%)
#!/usr/bin/perl -w
use strict;
use Archive::Zip qw(
my $zip = Archive::Zip->new;
my $member = $zip->addFile('hello');
$member->desiredCompressionLevel(9);
$zip->writeToFileNamed('hello-az.zip');
Now, let us compare relevant parts of the
[alanhaggai@archer zip]$
--------------------------------------------------
LOCAL FILE HEADER
--------------------------------------------------
Compressed_Size ->
18
Compression_Method ->
The file is Deflated
Filename ->
hello
General_Purpose_Bit_Flag ->
Maximum (-exx/-ex) compression option was used
Uncompressed_Size ->
39
CENTRAL DIRECTORY RECORD
--------------------------------------------------
Compressed_Size ->
18
Compression_Method ->
The file is Deflated
Filename ->
hello
General_Purpose_Bit_Flag ->
Maximum (-exx/-ex) compression option was used
Uncompressed_Size ->
39
[alanhaggai@archer zip]$
END CENTRAL DIRECTORY RECORD
--------------------------------------------------
LOCAL FILE HEADER
--------------------------------------------------
Compressed_Size ->
18
Compression_Method ->
The file is Deflated
Filename ->
hello
General_Purpose_Bit_Flag ->
Normal (-en) compression option was used
Uncompressed_Size ->
39
CENTRAL DIRECTORY RECORD
--------------------------------------------------
Compressed_Size ->
18
Compression_Method ->
The file is Deflated
Filename ->
hello
General_Purpose_Bit_Flag ->
Normal (-en) compression option was used
Uncompressed_Size ->
39
Both the files were compressed at level 9 (maximum compression). However, Archive::Zip did not set the `General Purpose Bit Flag', and so, suggest: `Normal (-en) compression option was used'.
In the case of hello-zip.zip produced by the zip utility, the flag's bits were set and suggest: `Maximum (-exx/-ex) compression option was used'.
Archive::Zip does not set General Purpose Bit Flag 0 Comments More | Login | Reply /