Gurus: I'm loosing my mind trying to figure the below issue out. I am trying to archive some XML, but when I get the following error: read error at C:\Perl\zipscript.pl line 90.
#!/usr/bin/perl -w use strict; use warnings; use File::Basename; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $procdate = sprintf "%02d%02d%02d%02d%02d%02d", (localtime)[4]+1, ( +localtime)[3], substr((localtime)[5]+1900,2,2),(localtime)[2], (local +time)[1], (localtime)[0]; #Pull in all the xml files for each report. my @dipfile = glob('C:/ReportExtract/Director/*.xml'); foreach my $xml_file (@dipfile) { ##### Zip each file into a zip file for archiving ##### my $targetdir = File::Spec->catdir('C:/ReportExtract/Director/'); my $targetzip = File::Spec->catdir($targetdir, basename($procd +ate) . ".zip"); #Need basename. my $zip = Archive::Zip->new(); my $zipdir = $zip->addDirectory($targetdir); my $temp = File::Basename::fileparse($xml_file); $zipdir = $zip->addFile('test.xml'); #$zip->writeToFileNamed($targetzip); unless ( $zip->writeToFileNamed($targetzip) eq "AZ_OK" ) { die 'read error';} };
Your help would be greatly appreciated. Thanks, Dave

In reply to Archive::Zip Simple Issue by drodinthe559

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.