Created
October 30, 2013 08:30
-
-
Save kshoji/7228989 to your computer and use it in GitHub Desktop.
Bug fix for the CPAN module Archive::Zip. The error `IO error: seeking to rewrite local header : Illegal seek` happened when write to the STDOUT.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# patch for Archive/Zip/Member.pm | |
# search the 'bitFlag' subroutine and replace it. | |
sub bitFlag { | |
my $self = shift; | |
# Set General Purpose Bit Flags according to the desiredCompressionLevel setting | |
my $hasDataDescriptor = $self->hasDataDescriptor(); | |
if ( $self->desiredCompressionLevel == 1 || $self->desiredCompressionLevel == 2 ) { | |
$self->{'bitFlag'} = DEFLATING_COMPRESSION_FAST | $hasDataDescriptor; | |
} elsif ( $self->desiredCompressionLevel == 3 || $self->desiredCompressionLevel == 4 | |
|| $self->desiredCompressionLevel == 5 || $self->desiredCompressionLevel == 6 | |
|| $self->desiredCompressionLevel == 7 ) { | |
$self->{'bitFlag'} = DEFLATING_COMPRESSION_NORMAL | $hasDataDescriptor; | |
} elsif ( $self->desiredCompressionLevel == 8 || $self->desiredCompressionLevel == 9 ) { | |
$self->{'bitFlag'} = DEFLATING_COMPRESSION_MAXIMUM | $hasDataDescriptor; | |
} | |
$self->{'bitFlag'}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment