Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

alanhaggai (8497)

alanhaggai
  (email not shown publicly)
http://alanhaggai.org/
Yahoo! ID: alan_haggai (Add User, Send Message)
Jabber: alanhaggai@gmail.com
+ -

  Journal: Back to coding on 2009.06.07 22:59

Journal by alanhaggai on 2009.06.07 22:59
User Journal

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!

Read More 0 comments

+ -

  Journal: Update on General Purpose Bit Flag bug on 2008.10.25 7:38

Journal by alanhaggai on 2008.10.25 7:38
User Journal

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.

Read More 0 comments

+ -

  Journal: Archive::Zip does not set General Purpose Bit Flag on 2008.10.24 13:15

Journal by alanhaggai on 2008.10.24 13:15
User Journal

After analysing few .zip files with the .Zip file parser (http://code.google.com/p/zipparser/), I was able to find out that Archive::Zip does not (for some reason) set the bits of General Purpose Bit Flag.

This means that .zip file members' compression levels will not be stored in the archive.

Let us reproduce it by creating two .zip files named hello-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( :ERROR_CODES :CONSTANTS );


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 .Zip files (several of the zip_parser.conf elements were commented out for brevity):

[alanhaggai@archer zip]$ ./zip_parser hello-zip.zip END CENTRAL DIRECTORY RECORD
--------------------------------------------------



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]$ ./zip_parser hello-az.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'.

Read More 0 comments

+ -

  Journal: Zip Parser on 2008.10.18 1:08

Journal by alanhaggai on 2008.10.18 1:08
User Journal
I have written a .Zip file parser. This parser can be (hopefully) used to identify buggy areas of Archive::Zip and possibly other .Zip file writers. Currently, it lacks the capability to parse Zip64 and encrypted .Zip files. I wish to add support for those soon.
Read More 0 comments

+ -

  Journal: Study of Data::ParseBinary on 2008.10.10 1:49

Journal by alanhaggai on 2008.10.10 1:49
User Journal
I have been studying Data::ParseBinary for a while. I sincerely hope to be able to build a dissector for .zip file format.
Read More 4 comments
Comments: 4
+ -

  Fixing Bugs in the Archive::Zip Perl Module on 2008.04.22 0:05 alanhaggai

Submitted by alanhaggai on 2008.04.22 0:05
CPAN
alanhaggai writes "Abstract: Perl programs often need to manipulate .zip files. Archive::Zip (http://search.cpan.org/dist/Archive-Zip/) is a Perl module that allows a Perl program to manage Zip archive files without calling an external utility.

The Archive::Zip module, however, has some bugs which prevent it from generating fully-portable .zip files, that are handled correctly by all .zip file readers and manipulators. The project's main aim is to address the outstanding bug reports (http://rt.cpan.org/Public/Dist/Display.html?Name=Archive-Zip), by using pyconstruct (http://pyconstruct.wikispaces.com/), which is a flexible framework for defining dissectors for binary formats in a declarative way.

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'.

"
Read More 0 comments

+ -

  Journal: Fixing Bugs in the Archive::Zip Perl Module on 2008.04.22 0:05

Journal by alanhaggai on 2008.04.22 0:05
CPAN

Abstract: Perl programs often need to manipulate .zip files. Archive::Zip (http://search.cpan.org/dist/Archive-Zip/) is a Perl module that allows a Perl program to manage Zip archive files without calling an external utility.

The Archive::Zip module, however, has some bugs which prevent it from generating fully-portable .zip files, that are handled correctly by all .zip file readers and manipulators. The project's main aim is to address the outstanding bug reports (http://rt.cpan.org/Public/Dist/Display.html?Name=Archive-Zip), by using pyconstruct (http://pyconstruct.wikispaces.com/), which is a flexible framework for defining dissectors for binary formats in a declarative way.

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'.

Read More 3 comments
Comments: 3