Subject: | Missing return value in Archive::Zip::Member::extractToFileNamed |
Date: | Sat, 14 Sep 2019 19:58:49 -0700 |
To: | bug-Archive-Zip [...] rt.cpan.org |
From: | Johannes Ernst <johannes.ernst [...] gmail.com> |
One of the two main branches of the code does not have a return value. Probably an oversight. Here’s the code, look for ===>>>
sub extractToFileNamed {
my $self = shift;
# local FS name
my $name = (ref($_[0]) eq 'HASH') ? $_[0]->{name} : $_[0];
$self->{'isSymbolicLink'} = 0;
# Check if the file / directory is a symbolic link or not
if ($self->{'externalFileAttributes'} == 0xA1FF0000) {
$self->{'isSymbolicLink'} = 1;
$self->{'newName'} = $name;
my ($status, $fh) = _newFileHandle($name, 'r');
my $retval = $self->extractToFileHandle($fh);
$fh->close();
===>>> this should say: return $retval
} else {
#return _writeSymbolicLink($self, $name) if $self->isSymbolicLink();
my ($status, $fh);
if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
$name = decode_utf8(Win32::GetFullPathName($name));
mkpath_win32($name);
Win32::CreateFile($name);
($status, $fh) = _newFileHandle(Win32::GetANSIPathName($name), 'w');
} else {
mkpath(dirname($name)); # croaks on error
($status, $fh) = _newFileHandle($name, 'w');
}
return _ioError("Can't open file $name for write") unless $status;
my $retval = $self->extractToFileHandle($fh);
$fh->close();
chmod($self->unixFileAttributes(), $name)
or return _error("Can't chmod() ${name}: $!");
utime($self->lastModTime(), $self->lastModTime(), $name);
return $retval;
}
}