in reply to Re: Archive::Zip - zip files are corrupted or invalid
in thread Archive::Zip - zip files are corrupted or invalid

Hi, thanks for the quick reply. I've made the change:
open my $fh, ">>", $fullpath or die $!; binmode $fh; print $log "Writer error.\n" if $zip->writeToFileNamed( $fh ) != AZ_OK +; close $fh;
But I still receive the same error on the file that is directly created by my script, not the one sent through ftp, so the binary mode in ftp wouldn't be the problem.

Replies are listed 'Best First'.
Re^3: Archive::Zip - zip files are corrupted or invalid
by Corion (Patriarch) on Jul 12, 2011 at 16:30 UTC
    $zip->writeToFileNamed( $fh )

    is likely wrong, at least when looking at Archive::Zip. You either want

    $zip->writeToFileHandle( $fh )

    or

    $zip->writeToFileNamed( $fullpath )

    Are you sure that you are looking at the correct file(s)? You also open $fh to append to $fullpath, which also strikes me as odd.

      oops! you're right, I should have been using:
      $zip->writeToFileHandle( $fh )
      I didn't see the distinction when looking through the docs.

      Also, I didn't catch that I was appending the the zip file because the filename is always supposed to be unique, but I will make that change as well.

      Thanks for your time, Tom