
Mordred
Novice
Oct 7, 2002, 2:51 PM
Post #1 of 8
(1991 views)
|
Archive::Zip Usage
|
Can't Post
|
|
Hi, I'm wondering of anyone can give me some pointers on the usage of Archive::Zip. I've looked at the examples and docs, but not one aspect of it will work for me. I must be doing something wrong. I am trying to extract a text file from a zip file, retrieve the contents of the text file, then use that text in the script. At the moment I'm using code as follows: $url = "$FORM{'fileurl'}/$filename"; $filepath = "$FORM{'filepath'}/$filename"; if ("$ext" eq "zip") { my $dirName = 'extractTest'; use Archive::Zip; my $zip = Archive::Zip->new(); my $status = $zip->read( $filepath ); if ("$status" eq "AZ_OK") { my $status = $zip->extractMemberWithoutPaths( $cfdescfile ); if ("$status" eq "AZ_OK") { $cfdescpath = "$FORM{'filepath'}/$cfdescfile"; $fsize = (-s $cfdescpath); open(IN,"$cfdescpath"); read(IN,$buf,$fsize); close(IN); } } } This recognizes the file as a zip but fails to do anything to it. It outputs no error messages. I find the docs for this package woefully inadequate. It looks like I'm basically gonna hafta just play with syntax after syntax till I stumble upon the right combo. Does anyone know of an easier way to do this?
|