Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: unable to extract same file twice using Archive::Zip

by Pickwick (Beadle)
on Jul 06, 2010 at 14:45 UTC ( [id://848230]=note: print w/replies, xml ) Need Help??


in reply to Re: unable to extract same file twice using Archive::Zip
in thread unable to extract same file twice using Archive::Zip

Your explanation of WHY you need to extract a particular file (or files) a second time fails the "plausibility test" with me...

Maybe I should have been more careful with my question because it's not, that I want to discuss why I have to keep the processing order or why there's even the need to do the processing twice on server and client. I really just wanted to know if one and the same zip member can be extracted more than once. And with one and the same I mean the same object, no zip reloading, nothing.

Worse, your simplified code gives no hint of HOW you attempt to unzip a member a second time,

Of course it does, I have a zip member on which extractToFileNamed is called twice and the second call fails.

nor of HOW you're directing the second attempt to a different directory (to avoid overwriting the first)

extractToFileNamed gets a temporary filename each time it's called from File::Temp::tempnam.

nowhere do you cite error messages supporting your description of what's happening

The error is AZ_STREAM_END as said before, but I don't understand why. The temporary file is created properly, it just gets no data.

use a standalone zip program?

Why should I day? Archive::Zip is the better tool for my needs.

copy the extracted file(s) that need dupes?

It's no problem to find another approach, I just wondered why something that easy like extracting a zip member object twice caused me trouble.

Close the zip and reopen for your second attempt?

Of course I can do that, and I do it now, but why should this be neccessary? The member class doesn't say something about that extracting more than once kills people.

If you believe the issue is in your module

Of course I don't. ;-)

Replies are listed 'Best First'.
Re^3: unable to extract same file twice using Archive::Zip
by ww (Archbishop) on Jul 06, 2010 at 17:59 UTC
    I stand corrected re the multiple extractions. Your simplified code does attempt to do so.

    re 'error messages' however, I still don't see them. Executing perldoc Archive::Zip will tell you:

    ERROR CODES Many of the methods in Archive::Zip return error codes. These are implemented as inline subroutines, using the "use constant" pragma +. They can be imported into your namespace using the ":ERROR_CODES" tag: use Archive::Zip qw( :ERROR_CODES ); ... unless ( $zip->read( 'myfile.zip' ) == AZ_OK ) { die "whoops!"; } AZ_OK (0) Everything is fine. AZ_STREAM_END (1) The read stream (or central directory) ended normally. AZ_ERROR (2) There was some generic kind of error. AZ_FORMAT_ERROR (3) There is a format error in a ZIP file being read. AZ_IO_ERROR (4) There was an IO error.

    The only one of these you cite is "AZ_STREAM_END" which does NOT indicate an error; far less, what kind of error.

    However, attempting to execute you alternate code (under w2k with A::Z v130 on perl 5.8 with strict and warnings; do you use these pragmas?) does pop up a message:

    Can't locate object method "extractToFileNames" via package "Archive::Zip::ZipFileMember" at 848152.pl line 13.

    And the meaning of your reply re suspecting the module boils down to interpretation of the wink? Perhaps you should consult the author, Adam Kennedy... but with better evidence than a wink.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-03-19 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found