-
-
03 Sep 2008 20:49:38 UTC
- Distribution: Compress-Zlib
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (1)
- Testers (472 / 0 / 1)
- Kwalitee
- License: perl_5
- Activity
24 month- Tools
- Download (63.46KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
NAME
Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib
DESCRIPTION
Common questions answered.
Compatibility with Unix compress/uncompress.
Although
Compress::Zlib
has a pair of functions calledcompress
anduncompress
, they are not related to the Unix programs of the same name. TheCompress::Zlib
module is not compatible with Unixcompress
.If you have the
uncompress
program available, you can use this to read compressed filesopen F, "uncompress -c $filename |"; while (<F>) { ...
Alternatively, if you have the
gunzip
program available, you can use this to read compressed filesopen F, "gunzip -c $filename |"; while (<F>) { ...
and this to write compress files, if you have the
compress
program availableopen F, "| compress -c $filename "; print F "data"; ... close F ;
Accessing .tar.Z files
The
Archive::Tar
module can optionally useCompress::Zlib
(via theIO::Zlib
module) to access tar files that have been compressed withgzip
. Unfortunately tar files compressed with the Unixcompress
utility cannot be read byCompress::Zlib
and so cannot be directly accessed byArchive::Tar
.If the
uncompress
orgunzip
programs are available, you can use one of these workarounds to read.tar.Z
files fromArchive::Tar
Firstly with
uncompress
use strict; use warnings; use Archive::Tar; open F, "uncompress -c $filename |"; my $tar = Archive::Tar->new(*F); ...
and this with
gunzip
use strict; use warnings; use Archive::Tar; open F, "gunzip -c $filename |"; my $tar = Archive::Tar->new(*F); ...
Similarly, if the
compress
program is available, you can use this to write a.tar.Z
fileuse 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 ;
Accessing Zip Files
This module does not support reading/writing zip files.
Support for reading/writing zip files is included with the
IO::Compress::Zip
andIO::Uncompress::Unzip
modules.The primary focus of the
IO::Compress::Zip
andIO::Uncompress::Unzip
modules is to provide anIO::File
compatible streaming read/write interface to zip files/buffers. They are not fully flegged archivers. If you are looking for an archiver check out theArchive::Zip
module. You can find it on CPAN athttp://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz
SEE ALSO
Compress::Zlib, IO::Compress::Gzip, IO::Uncompress::Gunzip, IO::Compress::Deflate, IO::Uncompress::Inflate, IO::Compress::RawDeflate, IO::Uncompress::RawInflate, IO::Compress::Bzip2, IO::Uncompress::Bunzip2, IO::Compress::Lzop, IO::Uncompress::UnLzop, IO::Compress::Lzf, IO::Uncompress::UnLzf, IO::Uncompress::AnyInflate, IO::Uncompress::AnyUncompress
File::GlobMapper, Archive::Zip, Archive::Tar, IO::Zlib
AUTHOR
This module was written by Paul Marquess, pmqs@cpan.org.
MODIFICATION HISTORY
See the Changes file.
COPYRIGHT AND LICENSE
Copyright (c) 2005-2008 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.
Module Install Instructions
To install Compress::Zlib, copy and paste the appropriate command in to your terminal.
cpanm Compress::Zlib
perl -MCPAN -e shell install Compress::Zlib
For more information on module installation, please visit the detailed CPAN module installation guide.