in reply to Process Zip

Your question isn't clear to me. Are you asking if there is a way to access a file within a zip archive without uncompressing the entire archive? Archive::Zip::MemberRead may be what you are looking for if that's the case.

Replies are listed 'Best First'.
Re^2: Process Zip
by bitman (Scribe) on Dec 08, 2010 at 11:03 UTC
    I want to process ALL files, one at a time, I don't know the file names.
      my $zip = new Archive::Zip; $zip->read('Filename.zip'); # ..obviously you have this already. my @memberNames = $zip->memberNames; # @memberNames is now a list of the files in the zip Archive.

      Now you iterate over that array like any other array.
      Is that what you wanted?

      After this, of course, you can extract the files by name (using the ->extractMember method) and delete the temporary file when you're done with it.

        Thank you all. I did go this route after all -
        use Archive::Zip; use Archive::Zip::MemberRead; ..... my $zip = Archive::Zip->new($file); my @ziplist=$zip->memberNames(); ..... foreach my $afile (@ziplist) { my $member = $zip->memberNamed($afile); my $fh=$member->readFileHandle(); while (my $line = $fh->getline()) {.... etc ....}

      Archive::Extract may prove intersting, though you will have to extract all of the files, process and delete them.

      An alternative would be to investigate somehow extracting them to memory rather than to file. You'd need to do some research on this.