SPUG: Archive::Zip:Member::_unixToDosTime problem
Richard Wood
wildwood_players at yahoo.com
Fri Feb 22 13:43:41 PST 2013
Ansering my own question I guess.
I can't explain it but I reformatted the file that was getting complaints to break up the XML so that there was one tag per line and for some reason, that got rid of the error. Maybe it was because the internal date was messed up and modifying it corrected it. Problem solved.
Sorry to have sent up a signal because of a corrupt file.
Regards,
Rich Wood
Richard O. Wood
Wildwood IT Consultants, Inc.
wildwood_players at yahoo.com
425.281.1914 mobile
________________________________
From: Richard Wood <wildwood_players at yahoo.com>
To: "spug-list at pm.org" <spug-list at pm.org>
Sent: Friday, February 22, 2013 10:07 AM
Subject: SPUG: Archive::Zip:Member::_unixToDosTime problem
Hi SPUG,
I am using Archive::Zip to create a MS WORD docx archive on win7 running ActivePerl Build 822 [280952].
It works mostly, but I think it is having problems with files that contain multiple full stops.
Example: word/_rels/document.xml.rels
The docx file is created, and I can even open it (sometimes with errors) which I suspect might be related to the complaining that Archive::Zip::Member::_unixToDosTime is doing about the one file that has a funny name (at least for WIN).
The code isn't much:
sub zip_docx {
$zip = Archive::Zip->new();
$zip->addTree('.');
$zipname = "$id".".docx";
print STDERR "trying to create $zipname\n";
$return = $zip->writeToFileNamed($zipname);
if ($return ne AZ_OK) {
print STDERR "Error creating $zipname rc: $return dollar_bang:$! :\n";
}
else {
print STDOUT "$zipname created\n";
}
}
Here are the errors:
C:\Users\nm040a\Desktop\FlatCQ>perl -w ../myperl/ddps/write_word.pl short.xml
IO error: Unsupported date before 1980 encountered, moving to 1980 : at C:/perl/lib/Archive/Zip/Member.pm line 491
Archive::Zip::Member::_unixToDosTime(315561600) called at C:/perl/lib/Archive/Zip/Member.pm line 180
Archive::Zip::Member::setLastModFileDateTimeFromUnix('Archive::Zip::NewFileMember=HASH(0x38913b4)', 315561600) called at C:/perl/lib/Archive/Zip/NewFileMember.pm line 36
Archive::Zip::NewFileMember::_newFromFileNamed('Archive::Zip::NewFileMember', './word/_rels/document.xml.rels', 'word/_rels/document.xml.rels') called at C:/perl/lib/Archive/Zip/Member.pm line 54
Archive::Zip::Member::newFromFile('Archive::Zip::Member', './word/_rels/document.xml.rels', 'word/_rels/document.xml.rels') called at C:/perl/lib/Archive/Zip/Archive.pm line 202
Archive::Zip::Archive::addFile('Archive::Zip::Archive=HASH(0x386316c)','./word/_rels/document.xml.rels', 'word/_rels/document.xml.rels') called at C:/perl/lib/Archive/Zip/Archive.pm line 607
Archive::Zip::Archive::addTree('Archive::Zip::Archive=HASH(0x386316c)',.) called at ../myperl/ddps/write_word.pl line 476
main::zip_docx() called at ../myperl/ddps/write_word.pl line 126
trying to create cms00002173.docx
Error creating cms00002173.docx rc: 0 dollar_bang: :
The direcory structure of the folder is this:
_rels
.rels
docProps
app.xml
core.xml
word
_rels
document.xml.rels
theme
theme1.xml
document.xml
fronTable.xml
settings.xml
styles.xml
webSettings.xml
Regards,
Rich Wood
Richard O. Wood
Wildwood IT Consultants, Inc.
wildwood_players at yahoo.com
425.281.1914 mobile
_____________________________________________________________
Seattle Perl Users Group Mailing List
POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
MEETINGS: 3rd Tuesdays
WEB PAGE: http://seattleperl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20130222/e2f9e7c0/attachment.html>
More information about the spug-list
mailing list