Posted on 2010-01-12 07:11:44.705633-08 by tbraber
Seek error with mod_perl and STDOUT

In version 1.30, $zip->writeToFileHandle( \*STDOUT, 0) is not working anymore.

In version 1.26 this was working ok.

The code I use looks similar to this:
my $zip = Archive::Zip->new(); my $member = $zip->addFile( '/home/testimg/test1.jpg', 'testfile1.jpg' ); if ($member){ $member->desiredCompressionLevel( 1 ); } $member = $zip->addFile( '/home/testimg/test2.ppt', 'testfile2.ppt' ); if ($member){ $member->desiredCompressionLevel( 4 ); } if ( $zip->numberOfMembers() ){ unless ( $zip->writeToFileHandle( \*STDOUT, 0) == Archive::Zip::AZ_OK) { print STDERR "Zip error: $!"; } }

This works fine with Archive::Zip version 1.26 but fails with version 1.30

The error is: 'IO error: seeking to rewrite local header : Invalid argument'

If I use desiredCompressionLevel(0) then there is no problem but no compression is done.

The error is only related to Mod_perl. As a console script it runs fine. Problem is on both Windows and Linux (perl 5.10).
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.