This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update IO-Compress to CPAN version 2.040
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Sun, 6 Nov 2011 22:56:39 +0000 (22:56 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Sun, 6 Nov 2011 23:49:04 +0000 (23:49 +0000)
  [DELTA]

  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

37 files changed:
Porting/Maintainers.pl
cpan/IO-Compress/Changes
cpan/IO-Compress/Makefile.PL
cpan/IO-Compress/README
cpan/IO-Compress/lib/Compress/Zlib.pm
cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm
cpan/IO-Compress/lib/IO/Compress/Adapter/Deflate.pm
cpan/IO-Compress/lib/IO/Compress/Adapter/Identity.pm
cpan/IO-Compress/lib/IO/Compress/Base.pm
cpan/IO-Compress/lib/IO/Compress/Base/Common.pm
cpan/IO-Compress/lib/IO/Compress/Bzip2.pm
cpan/IO-Compress/lib/IO/Compress/Deflate.pm
cpan/IO-Compress/lib/IO/Compress/Gzip.pm
cpan/IO-Compress/lib/IO/Compress/Gzip/Constants.pm
cpan/IO-Compress/lib/IO/Compress/RawDeflate.pm
cpan/IO-Compress/lib/IO/Compress/Zip.pm
cpan/IO-Compress/lib/IO/Compress/Zip/Constants.pm
cpan/IO-Compress/lib/IO/Compress/Zlib/Constants.pm
cpan/IO-Compress/lib/IO/Compress/Zlib/Extra.pm
cpan/IO-Compress/lib/IO/Uncompress/Adapter/Bunzip2.pm
cpan/IO-Compress/lib/IO/Uncompress/Adapter/Identity.pm
cpan/IO-Compress/lib/IO/Uncompress/Adapter/Inflate.pm
cpan/IO-Compress/lib/IO/Uncompress/AnyInflate.pm
cpan/IO-Compress/lib/IO/Uncompress/AnyUncompress.pm
cpan/IO-Compress/lib/IO/Uncompress/Base.pm
cpan/IO-Compress/lib/IO/Uncompress/Bunzip2.pm
cpan/IO-Compress/lib/IO/Uncompress/Gunzip.pm
cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm
cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm
cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm
cpan/IO-Compress/t/000prereq.t
cpan/IO-Compress/t/01misc.t
cpan/IO-Compress/t/050interop-gzip.t
cpan/IO-Compress/t/105oneshot-zip-only.t
cpan/IO-Compress/t/compress/oneshot.pl
cpan/IO-Compress/t/cz-14gzopen.t
pod/perldelta.pod

index dce3479..c1d3d2d 100755 (executable)
@@ -1034,7 +1034,7 @@ use File::Glob qw(:case);
     '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',
index 675689c..b71ee2f 100644 (file)
@@ -1,6 +1,30 @@
 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
index 3cb6272..8d4f391 100644 (file)
@@ -3,7 +3,7 @@
 use strict ;
 require 5.004 ;
 
-$::VERSION = '2.037' ;
+$::VERSION = '2.040' ;
 
 use private::MakeUtil;
 use ExtUtils::MakeMaker 5.16 ;
index 6f51a80..6ce4705 100644 (file)
@@ -1,9 +1,9 @@
 
                              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
@@ -89,7 +89,7 @@ To help me help you, I need all of the following information:
         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
index 5c19ccb..9051218 100644 (file)
@@ -7,17 +7,17 @@ use Carp ;
 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;
 
@@ -453,7 +453,7 @@ sub inflate
 
 package Compress::Zlib ;
 
-use IO::Compress::Gzip::Constants 2.037 ;
+use IO::Compress::Gzip::Constants 2.040 ;
 
 sub memGzip($)
 {
index ca351e2..ec4daa1 100644 (file)
@@ -4,13 +4,13 @@ use strict;
 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
 {
index 91e5843..94f2ad2 100644 (file)
@@ -4,12 +4,12 @@ use strict;
 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
 {
index c48c888..ef040fa 100644 (file)
@@ -4,10 +4,10 @@ use strict;
 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
 {
index 6f491f6..f0690da 100644 (file)
@@ -6,7 +6,7 @@ require 5.004 ;
 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);
@@ -20,7 +20,7 @@ use bytes;
 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.
 
@@ -123,9 +123,9 @@ sub output
     return 1 
         if length $data == 0 && ! $last ;
 
-    if ( *$self->{FilterEnvelope} ) {
+    if ( *$self->{FilterContainer} ) {
         *_ = \$data;
-        &{ *$self->{FilterEnvelope} }();
+        &{ *$self->{FilterContainer} }();
     }
 
     if (length $data) {
@@ -163,7 +163,7 @@ sub checkParams
             '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() 
@@ -214,7 +214,7 @@ sub _create
     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)
     {
index b6d3342..a788007 100644 (file)
@@ -11,7 +11,7 @@ use File::GlobMapper;
 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
@@ -451,7 +451,8 @@ sub createSelfTiedObject
 
 $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
                          )
                       ];              
@@ -463,7 +464,7 @@ use constant Parse_unsigned => 0x02;
 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 ;
@@ -741,6 +742,13 @@ sub IO::Compress::Base::Parameters::_checkType
         $$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 : "" ;    
@@ -937,7 +945,7 @@ sub subtract
 
     if ($value > $self->[LOW]) {
        -- $self->[HIGH] ;
-       $self->[LOW] = MAX32 - $self->[LOW] ;
+       $self->[LOW] = MAX32 - $value + $self->[LOW] + 1 ;
     }
     else {
        $self->[LOW] -= $value;
index e4bb983..9ff61ca 100644 (file)
@@ -5,16 +5,16 @@ use warnings;
 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);
@@ -51,7 +51,7 @@ sub getExtraParams
 {
     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],
index f2f0ce9..a29e0e2 100644 (file)
@@ -6,16 +6,16 @@ use bytes;
 
 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);
index 343d87f..5835961 100644 (file)
@@ -8,12 +8,12 @@ use warnings;
 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
 {
@@ -27,7 +27,7 @@ require Exporter ;
 
 our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
 
-$VERSION = '2.037';
+$VERSION = '2.040';
 $GzipError = '' ;
 
 @ISA    = qw(Exporter IO::Compress::RawDeflate);
index 918f3d2..65aff3c 100644 (file)
@@ -9,7 +9,7 @@ require Exporter;
 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);
 
index 4c75488..f4c519d 100644 (file)
@@ -7,16 +7,16 @@ use warnings;
 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);
@@ -142,8 +142,8 @@ sub getZlibParams
 {
     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 (
index 55588c0..1971bcb 100644 (file)
@@ -4,26 +4,27 @@ use strict ;
 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 ; 
          } ;
 }
 
@@ -32,7 +33,7 @@ require Exporter ;
 
 our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
 
-$VERSION = '2.037';
+$VERSION = '2.040';
 $ZipError = '';
 
 @ISA = qw(Exporter IO::Compress::RawDeflate);
@@ -155,6 +156,52 @@ sub filterUncompressed
     }
 }
 
+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;
@@ -163,11 +210,27 @@ sub mkHeader
 
     *$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 = '';
 
@@ -226,6 +289,9 @@ sub mkHeader
     $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
@@ -532,6 +598,12 @@ sub ckParams
         *$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 ;
 }
 
@@ -554,8 +626,8 @@ sub getExtraParams
 {
     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 = ();
     
@@ -577,6 +649,9 @@ sub getExtraParams
             '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], 
@@ -631,8 +706,15 @@ sub getFileInfo
     }
 
     # 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) ;
@@ -1112,12 +1194,67 @@ This parameter defaults to 0.
 
 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.
index 47fd751..82172bc 100644 (file)
@@ -7,7 +7,7 @@ require Exporter;
 
 our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
 
-$VERSION = '2.037';
+$VERSION = '2.040';
 
 @ISA = qw(Exporter);
 
@@ -51,6 +51,12 @@ $VERSION = '2.037';
     %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
@@ -94,13 +100,21 @@ use constant ZIP_EXTRA_ID_INFO_ZIP_Upath       => "up";
 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,
             );
 
 
index 4eeab80..9342e58 100644 (file)
@@ -9,7 +9,7 @@ require Exporter;
 
 our ($VERSION, @ISA, @EXPORT);
 
-$VERSION = '2.037';
+$VERSION = '2.040';
 
 @ISA = qw(Exporter);
 
index 66d0a2e..96bd5aa 100644 (file)
@@ -8,9 +8,9 @@ use bytes;
 
 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
 {
index 026627a..173a51d 100644 (file)
@@ -4,12 +4,12 @@ use strict;
 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
 {
index 4d36999..a4205fd 100644 (file)
@@ -4,14 +4,14 @@ use warnings;
 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
 {
index ab74496..ed0d173 100644 (file)
@@ -4,11 +4,11 @@ use strict;
 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';
 
 
 
index 4184f0d..20d9c84 100644 (file)
@@ -6,22 +6,22 @@ use strict;
 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 );
@@ -48,7 +48,7 @@ sub anyinflate
 
 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] ) ;
 }
 
index b7d8bf9..24343f5 100644 (file)
@@ -4,16 +4,16 @@ use strict;
 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 );
@@ -27,22 +27,22 @@ Exporter::export_ok_tags('all');
 
 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
@@ -60,7 +60,7 @@ sub anyuncompress
 
 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] ) ;
 }
index 7d07477..7be469f 100644 (file)
@@ -9,12 +9,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
 @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;
@@ -730,7 +730,7 @@ sub _rd2
 
         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} } = '' ;
             }
index b08ab47..0cc72eb 100644 (file)
@@ -4,15 +4,15 @@ use strict ;
 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 );
@@ -40,7 +40,7 @@ sub getExtraParams
 {
     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],
index e191ee6..5ce8508 100644 (file)
@@ -9,12 +9,12 @@ use strict ;
 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 ;
 
@@ -28,7 +28,7 @@ Exporter::export_ok_tags('all');
 
 $GunzipError = '';
 
-$VERSION = '2.037';
+$VERSION = '2.040';
 
 sub new
 {
@@ -47,7 +47,7 @@ sub gunzip
 
 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] ) ;
 }
 
index 7435de3..6a6ca8c 100644 (file)
@@ -5,15 +5,15 @@ use strict ;
 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 );
index f628eef..33cff78 100644 (file)
@@ -5,16 +5,16 @@ use strict ;
 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 );
index 0ef8813..054490f 100644 (file)
@@ -9,14 +9,14 @@ use warnings;
 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
 {
@@ -31,7 +31,7 @@ require Exporter ;
 
 our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
 
-$VERSION = '2.037';
+$VERSION = '2.040';
 $UnzipError = '';
 
 @ISA    = qw(Exporter IO::Uncompress::RawInflate);
@@ -64,7 +64,7 @@ sub unzip
 
 sub getExtraParams
 {
-    use IO::Compress::Base::Common  2.037 qw(:Parse);
+    use IO::Compress::Base::Common  2.040 qw(:Parse);
 
     
     return (
index a8e5452..312ec77 100644 (file)
@@ -25,7 +25,7 @@ BEGIN
         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
index a37aac0..76d6a7b 100644 (file)
@@ -19,7 +19,7 @@ BEGIN {
     $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');
@@ -63,6 +63,10 @@ sub My::testParseParameters()
     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:
     {
@@ -321,9 +325,17 @@ My::testParseParameters();
 
     $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);
index 22be064..b9c8da2 100644 (file)
@@ -10,6 +10,7 @@ use strict;
 use warnings;
 use bytes;
 
+use File::Spec ;
 use Test::More ;
 use CompTestUtils;
 
@@ -91,10 +92,13 @@ BEGIN {
 
     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 ;
 
index 0da219e..1f43c2c 100644 (file)
@@ -11,6 +11,7 @@ use warnings;
 use bytes;
 
 use Test::More ;
+use File::Spec ;
 use CompTestUtils;
 
 BEGIN {
@@ -23,13 +24,11 @@ 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)) ;
-
-
 }
 
 
@@ -133,6 +132,35 @@ sub zipGetHeader
     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)
index 102f221..14309ab 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
     $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)) ;
 
@@ -1578,8 +1578,26 @@ sub run
         }
     }
 
-}
 
+    {
+        # 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;
index 89b04ff..5d0f1fb 100644 (file)
@@ -491,7 +491,8 @@ foreach my $stdio ( ['-', '-'], [*STDIN, *STDOUT])
     {
         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 ;
index cf43423..904c6de 100644 (file)
@@ -131,6 +131,10 @@ L<Compress::Raw::Zlib> has been upgraded from version 2.037 to version 2.040.
 
 =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 *