Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Process Zip

by bitman (Beadle)
on Dec 08, 2010 at 11:03 UTC ( #875995=note: print w/ replies, xml ) Need Help??

in reply to Re: Process Zip
in thread Process Zip

I want to process ALL files, one at a time, I don't know the file names.

Comment on Re^2: Process Zip
Re^3: Process Zip
by marto (Bishop) on Dec 08, 2010 at 11:18 UTC

    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.

Re^3: Process Zip
by Demmy (Novice) on Dec 08, 2010 at 12:50 UTC
    my $zip = new Archive::Zip; $zip->read(''); # ..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 ....}

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://875995]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2015-05-24 08:24 GMT
Find Nodes?
    Voting Booth?

    In my home, the TV remote control is ...

    Results (471 votes), past polls