I am using Activestate Perl on Windows, and the Archive::Zip module (1.26)..
the zip file creation is
zip->new() create the object
zip->addfile(), add files to in memory object, repeat as many times a required
zip->writetoNamedFile(filename); write the in memory object to disk in one operation..
someplace in the last function, we encounter a 'read' error. fh->read() fails..(lib.rchive/Zip/newFileMeber.pm/_readRawChunk())
There is an error handler in the zip module package, so we know which file is causing the problem. (5 of them)..
turns out these files are open for write in another process.. so the error is understandable.. BUT.. if we drop to a commandline, we can COPY the file that we got the read error on without difficulty..
SO.. questions..
1. is there some open mode set incorrectly in the zip module Zip.pm/newFileMember.pm which could be corrected to avoid this read problem.
I don't see any 'cross process sharing mode flags' on the open like I see on a C runtime sopen() api.
2. why does the COPY command work?
3. I have been unable to reproduce this with a perl script as the writing process..
this 'file' happens to be a logfile for a long running subsystem component. so it might be 'in use' for months.
we coded up a 'workaround' but can't explain why it works..
use File::Copy
copy(badfile,tempfile);
zip->addfile(tempfile);
unlink(tempfile);
but why does the copy function work?
Sam
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.