X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FCompress%2FZlib%2FZlib.pm;h=f6e48ace8047d714e4af597cc21d8e25695d89cd;hb=667342e9372792655bd9e69275759a3f66394d54;hp=a831b4dc5818c21a5449ea94fdfb7d545272c46e;hpb=3c4b39bee8832007b7e91bfce8701d34cacab411;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/Compress/Zlib/Zlib.pm b/ext/Compress/Zlib/Zlib.pm index a831b4d..f6e48ac 100644 --- a/ext/Compress/Zlib/Zlib.pm +++ b/ext/Compress/Zlib/Zlib.pm @@ -1,7 +1,7 @@ # File : Zlib.pm # Author : Paul Marquess -# Created : 30 January 2005 -# Version : 1.35 +# Created : 23 September 2005 +# Version : 1.40 # # Copyright (c) 1995-2005 Paul Marquess. All rights reserved. # This program is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ use warnings ; our ($VERSION, @ISA, @EXPORT, $AUTOLOAD); our ($deflateDefault, $deflateParamsDefault, $inflateDefault); -$VERSION = "1.35" ; +$VERSION = "1.40" ; @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not export @@ -449,7 +449,6 @@ sub memGunzip($) 1; __END__ -=cut =head1 NAME @@ -877,7 +876,7 @@ compressed data. Otherwise it returns I. The source buffer can either be a scalar or a scalar reference. -The B<$level> parameter defines the compression level. Valid values are +The B<$level> paramter defines the compression level. Valid values are 0 through 9, C, C, C, and C. If B<$level> is not specified C will be used. @@ -1147,7 +1146,85 @@ The buffer parameters can either be a scalar or a scalar reference. If the $crc parameters is C, the crc value will be reset. -=head1 ACCESSING ZIP FILES +=head1 FAQ + +=head2 Compatibility with Unix compress/uncompress. + +Although C has a pair of functions called C +and C, they are I the same as the Unix programs of the +same name. The C library is not compatable with Unix +C. + +If you have the C program available, you can use this to +read compressed files + + open F, "uncompress -c $filename |"; + while () + { + ... + +If you have the C program available, you can use this to read +compressed files + + open F, "gunzip -c $filename |"; + while () + { + ... + +and this to write compress files if you have the C program +available + + open F, "| compress -c $filename "; + print F "data"; + ... + close F ; + +=head2 Accessing .tar.Z files + +The C module can optionally use C (via +the C module) to access tar files that have been compressed +with C. Unfortunately tar files compressed with the Unix C +utility cannot be read by C and so cannot be directly +accesses by C. + +If the C or C programs are available, you can use +one of these workarounds to read C<.tar.Z> files from C + +Firstly with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "uncompress -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +and this with C + + use strict; + use warnings; + use Archive::Tar; + + open F, "gunzip -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +Similarly, if the C program is available, you can use this to +write a C<.tar.Z> file + + use strict; + use warnings; + use Archive::Tar; + use IO::File; + + my $fh = newIO::File "| compress -c >$filename"; + my $tar = Archive::Tar->new(); + ... + $tar->write($fh); + $fh->close ; + +=head2 Accessing ZIP Files Although it is possible to use this module to access .zip files, there is a module on CPAN that will do all the hard work for you. Check out