'IO-Compress' =>
{
'MAINTAINER' => 'pmqs',
- 'DISTRIBUTION' => 'PMQS/IO-Compress-2.037.tar.gz',
+ 'DISTRIBUTION' => 'PMQS/IO-Compress-2.040.tar.gz',
'FILES' => q[cpan/IO-Compress],
'EXCLUDED' => [ qr{t/Test/} ],
'UPSTREAM' => 'cpan',
CHANGES
-------
+ 2.040 28 October 2011
+
+ * t/105oneshot-zip-only.t
+ - CanonicalName test failure on Windows
+ [RT# 68926]
+
+ * IO::Compress::Zip
+ - ExtAttr now populates MSDOS attributes
+
+ 2.039 28 October 2011
+
+ * IO::Compress::Zip
+ - Added CanonicalName option.
+ Note this option is set to true by default.
+ - Added FilterName option
+
+ * IO::Unompress::Base
+ - Fixed issue where setting $\ would corrupt the uncompressed data.
+ Thanks to Steffen Goeldner for reporting the issue.
+
+ * t/050interop-*.t
+ - Handle case when external command contains a whitespace
+ RT #71335
+
2.037 22 June 2011
* IO::Uncompress
use strict ;
require 5.004 ;
-$::VERSION = '2.037' ;
+$::VERSION = '2.040' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
IO-Compress
- Version 2.037
+ Version 2.040
- 22nd June 2011
+ 28th october 2011
Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
If you haven't installed IO-Compress then search IO::Compress::Gzip.pm
for a line like this:
- $VERSION = "2.037" ;
+ $VERSION = "2.040" ;
2. If you are having problems building IO-Compress, send me a
complete log of what happened. Start by unpacking the IO-Compress
use IO::Handle ;
use Scalar::Util qw(dualvar);
-use IO::Compress::Base::Common 2.037 ;
-use Compress::Raw::Zlib 2.037 ;
-use IO::Compress::Gzip 2.037 ;
-use IO::Uncompress::Gunzip 2.037 ;
+use IO::Compress::Base::Common 2.040 ;
+use Compress::Raw::Zlib 2.040 ;
+use IO::Compress::Gzip 2.040 ;
+use IO::Uncompress::Gunzip 2.040 ;
use strict ;
use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.037';
+$VERSION = '2.040';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.037 ;
+use IO::Compress::Gzip::Constants 2.040 ;
sub memGzip($)
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status);
+use IO::Compress::Base::Common 2.040 qw(:Status);
#use Compress::Bzip2 ;
-use Compress::Raw::Bzip2 2.037 ;
+use Compress::Raw::Bzip2 2.040 ;
our ($VERSION);
-$VERSION = '2.037';
+$VERSION = '2.040';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status);
+use IO::Compress::Base::Common 2.040 qw(:Status);
-use Compress::Raw::Zlib 2.037 qw(Z_OK Z_FINISH MAX_WBITS) ;
+use Compress::Raw::Zlib 2.040 qw(Z_OK Z_FINISH MAX_WBITS) ;
our ($VERSION);
-$VERSION = '2.037';
+$VERSION = '2.040';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status);
+use IO::Compress::Base::Common 2.040 qw(:Status);
our ($VERSION);
-$VERSION = '2.037';
+$VERSION = '2.040';
sub mkCompObject
{
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.037 ;
+use IO::Compress::Base::Common 2.040 ;
use IO::File qw(SEEK_SET SEEK_END); ;
use Scalar::Util qw(blessed readonly);
our (@ISA, $VERSION);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.037';
+$VERSION = '2.040';
#Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16.
return 1
if length $data == 0 && ! $last ;
- if ( *$self->{FilterEnvelope} ) {
+ if ( *$self->{FilterContainer} ) {
*_ = \$data;
- &{ *$self->{FilterEnvelope} }();
+ &{ *$self->{FilterContainer} }();
}
if (length $data) {
'Append' => [1, 1, Parse_boolean, 0],
'BinModeIn' => [1, 1, Parse_boolean, 0],
- 'FilterEnvelope' => [1, 1, Parse_any, undef],
+ 'FilterContainer' => [1, 1, Parse_code, undef],
$self->getExtraParams(),
*$self->{OneShot} ? $self->getOneShotParams()
my $merge = $got->value('Merge') ;
my $appendOutput = $got->value('Append') || $merge ;
*$obj->{Append} = $appendOutput;
- *$obj->{FilterEnvelope} = $got->value('FilterEnvelope') ;
+ *$obj->{FilterContainer} = $got->value('FilterContainer') ;
if ($merge)
{
require Exporter;
our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
@ISA = qw(Exporter);
-$VERSION = '2.037';
+$VERSION = '2.040';
@EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput
isaFileGlobString cleanFileGlobString oneTarget
$EXPORT_TAGS{Parse} = [qw( ParseParameters
Parse_any Parse_unsigned Parse_signed
- Parse_boolean Parse_custom Parse_string
+ Parse_boolean Parse_string
+ Parse_code
Parse_multiple Parse_writable_scalar
)
];
use constant Parse_signed => 0x04;
use constant Parse_boolean => 0x08;
use constant Parse_string => 0x10;
-use constant Parse_custom => 0x12;
+use constant Parse_code => 0x20;
#use constant Parse_store_ref => 0x100 ;
use constant Parse_multiple => 0x100 ;
$$output = defined $value ? $value != 0 : 0 ;
return 1;
}
+ elsif ($type & Parse_code)
+ {
+ return $self->setError("Parameter '$key' must be a code reference, got '$value'")
+ if $validate && (! defined $value || ref $value ne 'CODE') ;
+ $$output = defined $value ? $value : "" ;
+ return 1;
+ }
elsif ($type & Parse_string)
{
$$output = defined $value ? $value : "" ;
if ($value > $self->[LOW]) {
-- $self->[HIGH] ;
- $self->[LOW] = MAX32 - $self->[LOW] ;
+ $self->[LOW] = MAX32 - $value + $self->[LOW] + 1 ;
}
else {
$self->[LOW] -= $value;
use bytes;
require Exporter ;
-use IO::Compress::Base 2.037 ;
+use IO::Compress::Base 2.040 ;
-use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject);
-use IO::Compress::Adapter::Bzip2 2.037 ;
+use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject);
+use IO::Compress::Adapter::Bzip2 2.040 ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error);
-$VERSION = '2.037';
+$VERSION = '2.040';
$Bzip2Error = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.037 qw(:Parse);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
return (
'BlockSize100K' => [0, 1, Parse_unsigned, 1],
require Exporter ;
-use IO::Compress::RawDeflate 2.037 ;
+use IO::Compress::RawDeflate 2.040 ;
-use Compress::Raw::Zlib 2.037 ;
-use IO::Compress::Zlib::Constants 2.037 ;
-use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject);
+use Compress::Raw::Zlib 2.040 ;
+use IO::Compress::Zlib::Constants 2.040 ;
+use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
use bytes;
-use IO::Compress::RawDeflate 2.037 ;
+use IO::Compress::RawDeflate 2.040 ;
-use Compress::Raw::Zlib 2.037 ;
-use IO::Compress::Base::Common 2.037 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.037 ;
-use IO::Compress::Zlib::Extra 2.037 ;
+use Compress::Raw::Zlib 2.040 ;
+use IO::Compress::Base::Common 2.040 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.040 ;
+use IO::Compress::Zlib::Extra 2.040 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);
-$VERSION = '2.037';
+$VERSION = '2.040';
@ISA = qw(Exporter);
use bytes;
-use IO::Compress::Base 2.037 ;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
-use IO::Compress::Adapter::Deflate 2.037 ;
+use IO::Compress::Base 2.040 ;
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
+use IO::Compress::Adapter::Deflate 2.040 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.037 qw(:Parse);
- use Compress::Raw::Zlib 2.037 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
+ use Compress::Raw::Zlib 2.040 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
return (
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
-use IO::Compress::RawDeflate 2.037 ;
-use IO::Compress::Adapter::Deflate 2.037 ;
-use IO::Compress::Adapter::Identity 2.037 ;
-use IO::Compress::Zlib::Extra 2.037 ;
-use IO::Compress::Zip::Constants 2.037 ;
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
+use IO::Compress::RawDeflate 2.040 ;
+use IO::Compress::Adapter::Deflate 2.040 ;
+use IO::Compress::Adapter::Identity 2.040 ;
+use IO::Compress::Zlib::Extra 2.040 ;
+use IO::Compress::Zip::Constants 2.040 ;
+use File::Spec();
-use Compress::Raw::Zlib 2.037 qw(crc32) ;
+use Compress::Raw::Zlib 2.040 qw(crc32) ;
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.037 ;
+ import IO::Compress::Adapter::Bzip2 2.040 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.037 ;
+ import IO::Compress::Bzip2 2.040 ;
} ;
eval { require IO::Compress::Adapter::Lzma ;
import IO::Compress::Adapter::Lzma 2.036 ;
require IO::Compress::Lzma ;
- import IO::Compress::Lzma 2.037 ;
+ import IO::Compress::Lzma 2.040 ;
} ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
}
}
+sub canonicalName
+{
+ # This sub is derived from Archive::Zip::_asZipDirName
+
+ # Return the normalized name as used in a zip file (path
+ # separators become slashes, etc.).
+ # Will translate internal slashes in path components (i.e. on Macs) to
+ # underscores. Discards volume names.
+ # When $forceDir is set, returns paths with trailing slashes
+ #
+ # input output
+ # . '.'
+ # ./a a
+ # ./a/b a/b
+ # ./a/b/ a/b
+ # a/b/ a/b
+ # /a/b/ a/b
+ # c:\a\b\c.doc a/b/c.doc # on Windows
+ # "i/o maps:whatever" i_o maps/whatever # on Macs
+
+ my $name = shift;
+ my $forceDir = shift ;
+
+ my ( $volume, $directories, $file ) =
+ File::Spec->splitpath( File::Spec->canonpath($name), $forceDir );
+
+ my @dirs = map { $_ =~ s{/}{_}g; $_ }
+ File::Spec->splitdir($directories);
+
+ if ( @dirs > 0 ) { pop (@dirs) if $dirs[-1] eq '' } # remove empty component
+ push @dirs, defined($file) ? $file : '' ;
+
+ my $normalised_path = join '/', @dirs;
+
+ # Leading directory separators should not be stored in zip archives.
+ # Example:
+ # C:\a\b\c\ a/b/c
+ # C:\a\b\c.txt a/b/c.txt
+ # /a/b/c/ a/b/c
+ # /a/b/c.txt a/b/c.txt
+ $normalised_path =~ s{^/}{}; # remove leading separator
+
+ return $normalised_path;
+}
+
+
sub mkHeader
{
my $self = shift;
*$self->{ZipData}{LocalHdrOffset} = U64::clone(*$self->{ZipData}{Offset});
+ my $comment = '';
+ $comment = $param->value('Comment') || '';
+
my $filename = '';
$filename = $param->value('Name') || '';
- my $comment = '';
- $comment = $param->value('Comment') || '';
+ $filename = canonicalName($filename)
+ if length $filename && $param->value('CanonicalName') ;
+
+ if (defined *$self->{ZipData}{FilterName} ) {
+ local *_ = \$filename ;
+ &{ *$self->{ZipData}{FilterName} }() ;
+ }
+
+# if ( $param->value('UTF8') ) {
+# require Encode ;
+# $filename = Encode::encode_utf8($filename)
+# if length $filename ;
+# $comment = Encode::encode_utf8($filename)
+# if length $comment ;
+# }
my $hdr = '';
$gpFlag |= ZIP_GP_FLAG_LZMA_EOS_PRESENT
if $method == ZIP_CM_LZMA ;
+ #$gpFlag |= ZIP_GP_FLAG_LANGUAGE_ENCODING
+ #if $param->value('UTF8') && length($filename) + length($comment);
+
my $version = $ZIP_CM_MIN_VERSIONS{$method};
$version = ZIP64_MIN_VERSION
*$self->{ZipData}{Method} = ZIP_CM_STORE;
}
+ if ($got->parsed('FilterName')) {
+ my $v = $got->value('FilterName') ;
+ *$self->{ZipData}{FilterName} = $v
+ if ref $v eq 'CODE' ;
+ }
+
return 1 ;
}
{
my $self = shift ;
- use IO::Compress::Base::Common 2.037 qw(:Parse);
- use Compress::Raw::Zlib 2.037 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
+ use Compress::Raw::Zlib 2.040 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
my @Bzip2 = ();
'Comment' => [0, 1, Parse_any, ''],
'ZipComment'=> [0, 1, Parse_any, ''],
'Name' => [0, 1, Parse_any, ''],
+ 'FilterName'=> [0, 1, Parse_code, undef],
+ 'CanonicalName'=> [0, 1, Parse_boolean, 1],
+ #'UTF8' => [0, 1, Parse_boolean, 0],
'Time' => [0, 1, Parse_any, undef],
'exTime' => [0, 1, Parse_any, undef],
'exUnix2' => [0, 1, Parse_any, undef],
}
# NOTE - Unix specific code alert
- $params->value('ExtAttr' => $mode << 16)
- if ! $params->parsed('ExtAttr');
+ if (! $params->parsed('ExtAttr'))
+ {
+ use Fcntl qw(:mode) ;
+ my $attr = $mode << 16;
+ $attr |= ZIP_A_RONLY if ($mode & S_IWRITE) == 0 ;
+ $attr |= ZIP_A_DIR if ($mode & S_IFMT ) == S_IFDIR ;
+
+ $params->value('ExtAttr' => $attr);
+ }
$params->value('UID' => $uid) ;
$params->value('GID' => $gid) ;
Stores the contents of C<$string> in the zip filename header field.
-If C<Name> is not specified and the C<$input> parameter is a filename that
-will be used for the zip filename header field.
+If C<Name> is not specified and the C<$input> parameter is a filename, the
+value of C<$input> will be used for the zip filename header field.
If C<Name> is not specified and the C<$input> parameter is not a filename,
no zip filename field will be created.
+Note that both the C<CanonicalName> and C<FilterName> options
+can modify the value used for the zip filename header field.
+
+=item C<< CanonicalName => 0|1 >>
+
+This option controls whether the filename field in the zip header is
+I<normalized> into Unix format before being written to the zip file.
+
+It is recommended that you leave this option enabled unless you really need
+to create a non-standard Zip file.
+
+This is what APPNOTE.TXT has to say on what should be stored in the zip
+filename header field.
+
+ The name of the file, with optional relative path.
+ The path stored should not contain a drive or
+ device letter, or a leading slash. All slashes
+ should be forward slashes '/' as opposed to
+ backwards slashes '\' for compatibility with Amiga
+ and UNIX file systems etc.
+
+This option defaults to B<true>.
+
+=item C<< FilterName => sub { ... } >>
+
+This option allow the filename field in the zip header to be modified
+before it is written to the zip file.
+
+This option takes a parameter that must be a reference to a sub. On entry
+to the sub the C<$_> variable will contain the name to be filtered. If no
+filename is available C<$_> will contain an empty string.
+
+The value of C<$_> when the sub returns will be stored in the filename
+header field.
+
+Note that if C<CanonicalName> is enabled (and it is by default), a
+normalized filename will be passed to the sub.
+
+If you use C<FilterName> to modify the filename, it is your responsibility
+to keep the filename in Unix format.
+
+Although this option can be used with the OO ointerface, it is of most use
+with the one-shot interface. For example, the code below shows how
+C<FilterName> can be used to remove the path component from a series of
+filenames before they are stored in C<$zipfile>.
+
+ sub compressTxtFiles
+ {
+ my $zipfile = shift ;
+ my $dir = shift ;
+
+ zip [ <$dir/*.txt> ] => $zipfile,
+ FilterName => sub { s[^$dir/][] } ;
+ }
+
=item C<< Time => $number >>
Sets the last modified time field in the zip header to $number.
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.037';
+$VERSION = '2.040';
@ISA = qw(Exporter);
%ZIP_CM_MIN_VERSIONS
ZIP64_MIN_VERSION
+ ZIP_A_RONLY
+ ZIP_A_HIDDEN
+ ZIP_A_SYSTEM
+ ZIP_A_LABEL
+ ZIP_A_DIR
+ ZIP_A_ARCHIVE
);
# Compression types supported
use constant ZIP_EXTRA_ID_INFO_ZIP_Ucom => "uc";
use constant ZIP_EXTRA_ID_JAVA_EXE => pack "v", 0xCAFE;
+# DOS Attributes
+use constant ZIP_A_RONLY => 0x01;
+use constant ZIP_A_HIDDEN => 0x02;
+use constant ZIP_A_SYSTEM => 0x04;
+use constant ZIP_A_LABEL => 0x08;
+use constant ZIP_A_DIR => 0x10;
+use constant ZIP_A_ARCHIVE => 0x20;
+
use constant ZIP64_MIN_VERSION => 45;
%ZIP_CM_MIN_VERSIONS = (
- ZIP_CM_STORE() => 20,
- ZIP_CM_DEFLATE() => 20,
- ZIP_CM_BZIP2() => 46,
- ZIP_CM_LZMA() => 63,
+ ZIP_CM_STORE() => 20,
+ ZIP_CM_DEFLATE() => 20,
+ ZIP_CM_BZIP2() => 46,
+ ZIP_CM_LZMA() => 63,
);
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.037';
+$VERSION = '2.040';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.037';
+$VERSION = '2.040';
-use IO::Compress::Gzip::Constants 2.037 ;
+use IO::Compress::Gzip::Constants 2.040 ;
sub ExtraFieldError
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status);
+use IO::Compress::Base::Common 2.040 qw(:Status);
-use Compress::Raw::Bzip2 2.037 ;
+use Compress::Raw::Bzip2 2.040 ;
our ($VERSION, @ISA);
-$VERSION = '2.037';
+$VERSION = '2.040';
sub mkUncompObject
{
use strict;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status);
+use IO::Compress::Base::Common 2.040 qw(:Status);
use IO::Compress::Zip::Constants ;
our ($VERSION);
-$VERSION = '2.037';
+$VERSION = '2.040';
-use Compress::Raw::Zlib 2.037 ();
+use Compress::Raw::Zlib 2.040 ();
sub mkUncompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status);
-use Compress::Raw::Zlib 2.037 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.040 qw(:Status);
+use Compress::Raw::Zlib 2.040 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.037';
+$VERSION = '2.040';
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.037 ();
+use IO::Uncompress::Adapter::Inflate 2.040 ();
-use IO::Uncompress::Base 2.037 ;
-use IO::Uncompress::Gunzip 2.037 ;
-use IO::Uncompress::Inflate 2.037 ;
-use IO::Uncompress::RawInflate 2.037 ;
-use IO::Uncompress::Unzip 2.037 ;
+use IO::Uncompress::Base 2.040 ;
+use IO::Uncompress::Gunzip 2.040 ;
+use IO::Uncompress::Inflate 2.040 ;
+use IO::Uncompress::RawInflate 2.040 ;
+use IO::Uncompress::Unzip 2.040 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
sub getExtraParams
{
- use IO::Compress::Base::Common 2.037 qw(:Parse);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.040 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.037 ;
+use IO::Uncompress::Base 2.040 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.037 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.037 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.037 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.037 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.040 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.040 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.040 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.040 ;';
eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;';
eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;';
- eval ' use IO::Uncompress::Bunzip2 2.037 ;';
- eval ' use IO::Uncompress::UnLzop 2.037 ;';
- eval ' use IO::Uncompress::Gunzip 2.037 ;';
- eval ' use IO::Uncompress::Inflate 2.037 ;';
- eval ' use IO::Uncompress::RawInflate 2.037 ;';
- eval ' use IO::Uncompress::Unzip 2.037 ;';
- eval ' use IO::Uncompress::UnLzf 2.037 ;';
- eval ' use IO::Uncompress::UnLzma 2.037 ;';
- eval ' use IO::Uncompress::UnXz 2.037 ;';
+ eval ' use IO::Uncompress::Bunzip2 2.040 ;';
+ eval ' use IO::Uncompress::UnLzop 2.040 ;';
+ eval ' use IO::Uncompress::Gunzip 2.040 ;';
+ eval ' use IO::Uncompress::Inflate 2.040 ;';
+ eval ' use IO::Uncompress::RawInflate 2.040 ;';
+ eval ' use IO::Uncompress::Unzip 2.040 ;';
+ eval ' use IO::Uncompress::UnLzf 2.040 ;';
+ eval ' use IO::Uncompress::UnLzma 2.040 ;';
+ eval ' use IO::Uncompress::UnXz 2.040 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.037 qw(:Parse);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ,
'UnLzma' => [1, 1, Parse_boolean, 0] ) ;
}
@ISA = qw(Exporter IO::File);
-$VERSION = '2.037';
+$VERSION = '2.040';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.037 ;
+use IO::Compress::Base::Common 2.040 ;
use IO::File ;
use Symbol;
while (($status = $z->read($x->{buff})) > 0) {
if ($fh) {
- print $fh ${ $x->{buff} }
+ syswrite $fh, ${ $x->{buff} }
or return $z->saveErrorString(undef, "Error writing to output file: $!", $!);
${ $x->{buff} } = '' ;
}
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.037 ;
-use IO::Uncompress::Adapter::Bunzip2 2.037 ;
+use IO::Uncompress::Base 2.040 ;
+use IO::Uncompress::Adapter::Bunzip2 2.040 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.037';
+$VERSION = '2.040';
$Bunzip2Error = '';
@ISA = qw( Exporter IO::Uncompress::Base );
{
my $self = shift ;
- use IO::Compress::Base::Common 2.037 qw(:Parse);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
return (
'Verbosity' => [1, 1, Parse_boolean, 0],
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.037 ;
+use IO::Uncompress::RawInflate 2.040 ;
-use Compress::Raw::Zlib 2.037 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.037 ;
-use IO::Compress::Zlib::Extra 2.037 ;
+use Compress::Raw::Zlib 2.040 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.040 ;
+use IO::Compress::Zlib::Extra 2.040 ;
require Exporter ;
$GunzipError = '';
-$VERSION = '2.037';
+$VERSION = '2.040';
sub new
{
sub getExtraParams
{
- use IO::Compress::Base::Common 2.037 qw(:Parse);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.037 ;
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.040 ;
-use IO::Uncompress::RawInflate 2.037 ;
+use IO::Uncompress::RawInflate 2.040 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.037 ;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
+use Compress::Raw::Zlib 2.040 ;
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.037 ;
-use IO::Uncompress::Adapter::Inflate 2.037 ;
+use IO::Uncompress::Base 2.040 ;
+use IO::Uncompress::Adapter::Inflate 2.040 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.037';
+$VERSION = '2.040';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
use bytes;
use IO::File;
-use IO::Uncompress::RawInflate 2.037 ;
-use IO::Compress::Base::Common 2.037 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.037 ;
-use IO::Uncompress::Adapter::Identity 2.037 ;
-use IO::Compress::Zlib::Extra 2.037 ;
-use IO::Compress::Zip::Constants 2.037 ;
+use IO::Uncompress::RawInflate 2.040 ;
+use IO::Compress::Base::Common 2.040 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Inflate 2.040 ;
+use IO::Uncompress::Adapter::Identity 2.040 ;
+use IO::Compress::Zlib::Extra 2.040 ;
+use IO::Compress::Zip::Constants 2.040 ;
-use Compress::Raw::Zlib 2.037 qw(crc32) ;
+use Compress::Raw::Zlib 2.040 qw(crc32) ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.037';
+$VERSION = '2.040';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
sub getExtraParams
{
- use IO::Compress::Base::Common 2.037 qw(:Parse);
+ use IO::Compress::Base::Common 2.040 qw(:Parse);
return (
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.037';
+ my $VERSION = '2.040';
my @NAMES = qw(
Compress::Raw::Bzip2
Compress::Raw::Zlib
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 132 + $extra ;
+ plan tests => 136 + $extra ;
use_ok('Scalar::Util');
use_ok('IO::Compress::Base::Common');
like $@, mkErr("Parameter 'Fred' must be a signed int, got 'abc'"),
"wanted signed, got 'abc'";
+ eval { ParseParameters(1, {'Fred' => [1, 1, Parse_code, undef]}, Fred => 'abc') ; };
+ like $@, mkErr("Parameter 'Fred' must be a code reference, got 'abc'"),
+ "wanted code, got 'abc'";
+
SKIP:
{
$x->subtract($y);
is $x->getHigh, 0, " getHigh is 0";
- is $x->getLow, 0xFFFFFFFD, " getLow is 1";
+ is $x->getLow, 0xFFFFFFFF, " getLow is 1";
ok ! $x->is64bit(), " ! is64bit";
+ $x = new U64(0x01CADCE2, 0x4E815983);
+ $y = new U64(0x19DB1DE, 0xD53E8000); # NTFS to Unix time delta
+
+ $x->subtract($y);
+ is $x->getHigh, 0x2D2B03, " getHigh is 2D2B03";
+ is $x->getLow, 0x7942D983, " getLow is 7942D983";
+ ok $x->is64bit(), " is64bit";
+
title "U64 - equal" ;
$x = new U64(0, 1);
use warnings;
use bytes;
+use File::Spec ;
use Test::More ;
use CompTestUtils;
for my $dir (reverse split $split, $ENV{PATH})
{
- $GZIP = "$dir/$name"
- if -x "$dir/$name" ;
+ $GZIP = File::Spec->catfile($dir,$name)
+ if -x File::Spec->catfile($dir,$name)
}
+ # Handle spaces in path to gzip
+ $GZIP = "\"$GZIP\"" if $GZIP =~ /\s/;
+
plan(skip_all => "Cannot find $name")
if ! $GZIP ;
use bytes;
use Test::More ;
+use File::Spec ;
use CompTestUtils;
BEGIN {
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 170 + $extra ;
+ plan tests => 216 + $extra ;
#use_ok('IO::Compress::Zip', qw(zip $ZipError :zip_method)) ;
use_ok('IO::Compress::Zip', qw(:all)) ;
use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ;
-
-
}
cmp_ok $hdr->{Time} >> 1, '<=', $after >> 1, " Time is ok";
}
+{
+ title "Check CanonicalName & FilterName";
+
+ my $lex = new LexFile my $file1;
+
+ my $content = "hello" ;
+ writeFile($file1, $content);
+ my $hdr;
+
+ my $abs = File::Spec->catfile("", "fred", "joe");
+ $hdr = zipGetHeader($file1, $content, Name => $abs, CanonicalName => 1) ;
+ is $hdr->{Name}, "fred/joe", " Name is 'fred/joe'" ;
+
+ $hdr = zipGetHeader($file1, $content, Name => $abs, CanonicalName => 0) ;
+ is $hdr->{Name}, File::Spec->catfile("", "fred", "joe"), " Name is '/fred/joe'" ;
+
+ $hdr = zipGetHeader($file1, $content, FilterName => sub {$_ = "abcde"});
+ is $hdr->{Name}, "abcde", " Name is 'abcde'" ;
+
+ $hdr = zipGetHeader($file1, $content, Name => $abs,
+ FilterName => sub { s/joe/jim/ });
+ is $hdr->{Name}, "fred/jim", " Name is 'fred/jim'" ;
+
+ $hdr = zipGetHeader($file1, $content, Name => $abs,
+ CanonicalName => 0,
+ FilterName => sub { s/joe/jim/ });
+ is $hdr->{Name}, File::Spec->catfile("", "fred", "jim"), " Name is '/fred/jim'" ;
+}
+
for my $stream (0, 1)
{
for my $zip64 (0, 1)
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 986 + $extra ;
+ plan tests => 989 + $extra ;
use_ok('IO::Uncompress::AnyUncompress', qw(anyuncompress $AnyUncompressError)) ;
}
}
-}
+ {
+ # check setting $/
+
+ my $CompFunc = getTopFuncRef($CompressClass);
+ my $UncompFunc = getTopFuncRef($UncompressClass);
+ my $lex = new LexFile my $file ;
+
+ local $\ = "\n" ;
+ my $input = "hello world";
+ my $compressed ;
+ my $output;
+ ok &$CompFunc(\$input => \$compressed), ' Compressed ok' ;
+ ok &$UncompFunc(\$compressed => $file), ' UnCompressed ok' ;
+ my $content = readFile($file) ;
+ is $content, $input, "round trip ok" ;
+
+ }
+
+}
# TODO add more error cases
1;
{
my $lex = new LexFile my $name ;
writeFile($name, "abc");
- chmod 0444, $name ;
+ chmod 0444, $name
+ or skip "Cannot create non-writable file", 3 ;
skip "Cannot create non-writable file", 3
if -w $name ;
=item *
+L<Compress::Zlib> has been upgraded from version 2.037 to version 2.040.
+
+=item *
+
L<CPANPLUS::Dist::Build> has been upgraded from version 0.58 to version 0.60.
=item *