=head1 NAME Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib =head1 DESCRIPTION Common questions answered. =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 compatible with Unix C. If you have the C program available, you can use this to read compressed files open F, "uncompress -c $filename |"; while () { ... Alternatively, 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 = new IO::File "| compress -c >$filename"; my $tar = Archive::Tar->new(); ... $tar->write($fh); $fh->close ; =head2 Accessing Zip Files Although it is possible (with some effort on your part) 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 the C module on CPAN at http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz Assuming you don't want to use this module to access zip files there are a number of undocumented features in the zlib library you need to be aware of. =over 5 =item 1. When calling B or B the B parameter must be set to C<-MAX_WBITS>. This enables the creation of an RFC1951 compressed data stream. =item 2. If you are using zlib older than 1.2.0, The zlib function B, and so the B method supplied in this module, assume that there is at least one trailing byte after the compressed data stream. Normally this isn't a problem because both the gzip and zip file formats will guarantee that there is data directly after the compressed data stream. =back =head2 Zlib Library Version Support By default C will build with a private copy of version 1.2.3 of the zlib library. (See the F file for details of how to override this behaviour) If you decide to use a different version of the zlib library, you need to be aware of the following issues =over 5 =item * First off, you must have zlib 1.0.5 or better. =item * You need to have zlib 1.2.1 or better if you want to use the C<-Merge> option with C, C and C. =back =head1 SEE ALSO L, L, L, L, L, L, L, L L L, L, L For RFC 1950, 1951 and 1952 see F, F and F The primary site for the gzip program is F. =head1 AUTHOR The I<> module was written by Paul Marquess, F. The latest copy of the module can be found on CPAN in F. The I compression library was written by Jean-loup Gailly F and Mark Adler F. The primary site for the I compression library is F. =head1 MODIFICATION HISTORY See the Changes file. =head1 COPYRIGHT AND LICENSE Copyright (c) 2005-2006 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.