I am glad to be back on track after some time. Started to write tests first. It is interesting.
I am rewriting support for named arguments in Archive-Zip (which I had added earlier), so that this time, there will be automated tests for them. Tests were manual earlier, of which I got tired soon due to one-thing-breaking-the-other, and the chain-of-reactions!
bitFlag() sub was modified with the addition of the following conditions:
Desired Compression Level | Speed / Compression
1, 2 | Fast
3, 4, 5, 6, 7 | Normal
8, 9 | Maximum
Thus, Archive::Zip will set the bits exactly the same way that the GNU/Linux zip utility does.
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'.
My work on Archive::Zip has been stopped for two weeks as my right-eye contracted a viral infection. I am applying eye-drops and ointments. However, it is difficult to concentrate in work as I have to take frequent naps. Also, the right eye has got blurred in vision due to the disease. The blurriness interferes a lot. So, I thought of stopping the work for two weeks, which is the period within which I hope the eye will cure ( the doctor said so ).
I will post as soon as I get back to work.
My study of the
Magic bytes
Magic numbers are common in programs across many operating systems. Magic numbers implement strongly typed data and are a form of in-band signaling to the controlling program that reads the data type(s) at program run-time. Many files have such constants that identify the contained data. Detecting such constants in files is a simple and effective way of distinguishing between many file formats and can yield further run-time information.
That is Wikipedia's definition of magic bytes / numbers.
0x50 0x45 at offset 0x00.
0x50 = P,
and 0x45 = K in ASCII.
PK stands for Phil Katz, the creator of the
Meta Data
Limitations
My proposal `Fixing Bugs in the Archive::Zip Perl Module' has been accepted by The Perl Foundation. Shlomi Fish ( http://www.shlomifish.org ) helped me with the proposal, supported me and also encouraged me.
Thank you very much Shlomi.
I am having examinations at college now. I will start working as soon as the examinations are over.
Abstract: Perl programs often need to manipulate
The Archive::Zip module, however, has some bugs which prevent it from generating fully-portable
I have to start working on the project soon. I, most probably, will be having the time to work from the start of May 2008. I am very thrilled to work on it and be part of the Perl community.
Hope the project goes well. I am also applying for `The Perl Foundation Grants'.