Subject: | overwrite method fails for archives without an extension |
If one creates an Archive::Zip object for an archive that doesn't have an extension (say 'foo') then the overwrite() method deletes the file.
The problem is the generation of the backup file name in overwriteAs():
( my $backupName = $zipName ) =~ s{\.[^.]*$}{.zbk};
If $zipName doesn't match the substitution then $backupName keeps it's original state, which is the same as $zipName:
Archive::Zip::Archive::overwriteAs(/usr/local/lib/perl5/site_perl/5.8.2/Archive/Zip.pm:762):
762: ( my $backupName = $zipName ) =~ s{\.[^.]*$}{.zbk};
DB<2> p $zipName
foo
DB<3> p $backupName
foo
DB<4>
and since later on in the method $backupName is unlinked... kapoof goes the archive.
This is probably not a common occurence (I only stumbled across it by accident), but a bit surprising I'm sure you'll agree.
Regards.