SPUG: Archive::Zip:Member::_unixToDosTime problem

Richard Wood wildwood_players at yahoo.com
Fri Feb 22 10:07:23 PST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20130222/da037fb6/attachment-0001.html>


More information about the spug-list mailing list