Archive-Zip
view release on metacpan or search on metacpan
1.63 Wed 21 Aug 2018
- Restore missing META.yml deps (needed updated MB)
- Symlink traversal test fix [github/haarg]
- Added missing prereq Encode as suggested by CPANTS [github/manwar]
1.62 Sun 19 Aug 2018
- Add link-samename.zip to MANIFEST
1.61 Sat 18 Aug 2018
- File::Find will not untaint [github/ThisUsedToBeAnEmail]
- Prevent from traversing symlinks and parent directories when extracting [github/ppisar]
1.60 Tue 19 Dec 2017
- RT 123913 Wrong shell bang in examples/selfex.pl
1.59 Thu 11 Aug 2016
- update Makefile.PL metadata to CPAN Meta specification 2.0
1.58 Tue 2 Aug 2016
- avoid relying on . being in @INC [github/karenetheridge]
- Fixed use of binmode with pseudo-file handles
- Removed qr{} form for older Perl versions
- Changed rel2abs logic in _asLocalName() if there is a volume
- Fixed errors with making directories in extractMember() when none provided
- Return AZ_OK in extractMemberWithoutPaths() if member is a directory
- Fixed problem in extractTree with blank directory becoming "." prefix
- Added examples/writeScalar2.pl to show how to use IO::String as destination of Zip write
- Edited docs and FAQ to recommend against using absolute path names in zip files.
1.05 Wed Sep 11 12:31:20 PDT 2002
- fixed untaint from 1.04
1.04 Wed Sep 11 07:22:04 PDT 2002
- added untaint of lastModFileDateTime
1.03 Mon Sep 2 20:42:43 PDT 2002
- Removed dependency on IO::Scalar
- Set required version of File::Spec to 0.8
- Removed tests of examples that needed IO::Scalar
- Added binmode() call to read/writeScalar examples
- Fixed addTree() for 5.005 compatibility (still untested with 5.004)
- Fixed mkdir() calls for 5.005
- Clarified documentation of tree operations
lib/Archive/Zip.pm view on Meta::CPAN
Create a uniquely named temp file. It will be returned open
for read/write. If C<$tmpdir> is given, it is used as the
name of a directory to create the file in. If not given,
creates the file using C<File::Spec::tmpdir()>. Generally, you can
override this choice using the
$ENV{TMPDIR}
environment variable. But see the L<File::Spec|File::Spec>
documentation for your system. Note that on many systems, if you're
running in taint mode, then you must make sure that C<$ENV{TMPDIR}> is
untainted for it to be used.
Will I<NOT> create C<$tmpdir> if it does not exist (this is a change
from prior versions!). Returns file handle and name:
my ($fh, $name) = Archive::Zip::tempFile();
my ($fh, $name) = Archive::Zip::tempFile('myTempDir');
my $fh = Archive::Zip::tempFile(); # if you don't need the name
=back
=head2 Zip Archive Accessors
lib/Archive/Zip.pm view on Meta::CPAN
* Text file extraction (line end translation)
* Reading zip files from non-seekable inputs
(Perhaps by proxying through IO::String?)
* separate unused constants into separate module
* cookbook style docs
* Handle tainted paths correctly
* Work on better compatibility with other IO:: modules
* Support encryption
* More user-friendly decryption
=head1 SUPPORT
Bugs should be reported on GitHub
lib/Archive/Zip/Archive.pm view on Meta::CPAN
if ($pos >= 0) {
$fh->seek($pos - $seekOffset, IO::Seekable::SEEK_CUR)
or return _ioError("seeking to EOCD");
return AZ_OK;
} else {
return _formatError("can't find EOCD signature");
}
}
# Used to avoid taint problems when chdir'ing.
# Not intended to increase security in any way; just intended to shut up the -T
# complaints. If your Cwd module is giving you unreliable returns from cwd()
# you have bigger problems than this.
sub _untaintDir {
my $dir = shift;
$dir =~ m/$UNTAINT/s;
return $1;
}
sub addTree {
my $self = shift;
my ($root, $dest, $pred, $compressionLevel);
if (ref($_[0]) eq 'HASH') {
lib/Archive/Zip/Archive.pm view on Meta::CPAN
($root, $dest, $pred, $compressionLevel) = @_;
}
return _error("root arg missing in call to addTree()")
unless defined($root);
$dest = '' unless defined($dest);
$pred = sub { -r }
unless defined($pred);
my @files;
my $startDir = _untaintDir(cwd());
return _error('undef returned by _untaintDir on cwd ', cwd())
unless $startDir;
# This avoids chdir'ing in Find, in a way compatible with older
# versions of File::Find.
my $wanted = sub {
local $main::_ = $File::Find::name;
my $dir = _untaintDir($File::Find::dir);
chdir($startDir);
if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
push(@files, Win32::GetANSIPathName($File::Find::name)) if (&$pred);
$dir = Win32::GetANSIPathName($dir);
} else {
push(@files, $File::Find::name) if (&$pred);
}
chdir($dir);
};
if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
$root = Win32::GetANSIPathName($root);
}
# File::Find will not untaint unless you explicitly pass the flag and regex pattern.
File::Find::find({ wanted => $wanted, untaint => 1, untaint_pattern => $UNTAINT }, $root);
my $rootZipName = _asZipDirName($root, 1); # with trailing slash
my $pattern = $rootZipName eq './' ? '^' : "^\Q$rootZipName\E";
$dest = _asZipDirName($dest, 1); # with trailing slash
foreach my $fileName (@files) {
my $isDir;
if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) {
$isDir = -d Win32::GetANSIPathName($fileName);
lib/Archive/Zip/Archive.pm view on Meta::CPAN
unless defined($root);
$dest = '' unless defined($dest);
$pred = sub { -r }
unless defined($pred);
$dest = _asZipDirName($dest, 1);
my $rootZipName = _asZipDirName($root, 1); # with trailing slash
my $pattern = $rootZipName eq './' ? '^' : "^\Q$rootZipName\E";
my @files;
my $startDir = _untaintDir(cwd());
return _error('undef returned by _untaintDir on cwd ', cwd())
unless $startDir;
# This avoids chdir'ing in Find, in a way compatible with older
# versions of File::Find.
my $wanted = sub {
local $main::_ = $File::Find::name;
my $dir = _untaintDir($File::Find::dir);
chdir($startDir);
push(@files, $File::Find::name) if (&$pred);
chdir($dir);
};
File::Find::find($wanted, $root);
# Now @files has all the files that I could potentially be adding to
# the zip. Only add the ones that are necessary.
# For each file (updated or not), add its member name to @done.
lib/Archive/Zip/Member.pm view on Meta::CPAN
my $self = shift;
my $bytes = $self->{'fileName'};
if($self->{'bitFlag'} & 0x800){
$bytes = Encode::encode_utf8($bytes);
}
return $bytes;
}
sub lastModFileDateTime {
my $modTime = shift->{'lastModFileDateTime'};
$modTime =~ m/^(\d+)$/; # untaint
return $1;
}
sub lastModTime {
my $self = shift;
return _dosToUnixTime($self->lastModFileDateTime());
}
sub setLastModFileDateTimeFromUnix {
my $self = shift;
( run in 0.482 second using v1.01-cache-2.11-cpan-4e96b696675 )