Subject: | Cannot create member called "0" with addString |
This issue concerns addString, where the member name is "0".
This code will trigger the issue
use strict;
use warnings;
# Create a Zip file
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $zip = Archive::Zip->new();
my $string_member = $zip->addString("abc" => 0);
# Save the Zip file
unless ( $zip->writeToFileNamed('someZip.zip') == AZ_OK ) {
die 'write error\n';
}
Here is the error I get with 1.31_04
$ perl -Mblib try.pl
error: no member name given for Archive::Zip::StringMember=HASH(0x9140960)
at /linux-shared/Archive-Zip-1.31_04/blib/lib/Archive/Zip/Member.pm
line 1055.
Archive::Zip::Member::_writeToFileHandle('Archive::Zip::StringMember=HASH(0x9140960)', 'IO::File=GLOB(0x9140e20)', 1, 0) called at /linux-shared/Archive-Zip-1.31_04/blib/lib/Archive/Zip/Archive.pm line 428
Archive::Zip::Archive::writeToFileHandle('Archive::Zip::Archive=HASH(0x8e41758)', 'IO::File=GLOB(0x9140e20)', 1) called at /linux-shared/Archive-Zip-1.31_04/blib/lib/Archive/Zip/Archive.pm line 396
Archive::Zip::Archive::writeToFileNamed('Archive::Zip::Archive=HASH(0x8e41758)', 'someZip.zip') called at try.pl line 10
write error\n at try.pl line 11.
I'll post a patch shortly.
Paul