summaryrefslogtreecommitdiff
path: root/cpan/IO-Compress/lib/IO/Compress/FAQ.pod
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/IO-Compress/lib/IO/Compress/FAQ.pod')
-rw-r--r--cpan/IO-Compress/lib/IO/Compress/FAQ.pod183
1 files changed, 97 insertions, 86 deletions
diff --git a/cpan/IO-Compress/lib/IO/Compress/FAQ.pod b/cpan/IO-Compress/lib/IO/Compress/FAQ.pod
index ee8a2c6569..c1059101c1 100644
--- a/cpan/IO-Compress/lib/IO/Compress/FAQ.pod
+++ b/cpan/IO-Compress/lib/IO/Compress/FAQ.pod
@@ -1,12 +1,14 @@
=head1 NAME
-IO::Compress::FAQ -- Frequently Asked Questions about IO::Compress
+IO::Conmpress::FAQ -- Frequently Asked Questions about IO::Compress
=head1 DESCRIPTION
Common questions answered.
+=head1 GENERAL
+
=head2 Compatibility with Unix compress/uncompress.
Although C<Compress::Zlib> has a pair of functions called C<compress> and
@@ -83,18 +85,62 @@ write a C<.tar.Z> file
$tar->write($fh);
$fh->close ;
-=head2 Accessing Zip Files
+=head2 How do I recompress using a different compression?
+
+This is easier that you might expect if you realise that all the
+C<IO::Compress::*> objects are derived from C<IO::File> and that all the
+C<IO::Uncompress::*> modules can read from an C<IO::File> filehandle.
+
+So, for example, say you have a file compressed with gzip that you want to
+recompress with bzip2. Here is all that is needed to carry out the
+recompression.
+
+ use IO::Uncompress::Gunzip ':all';
+ use IO::Compress::Bzip2 ':all';
+
+ my $gzipFile = "somefile.gz";
+ my $bzipFile = "somefile.bz2";
-This module provides support for reading/writing zip files using the
-C<IO::Compress::Zip> and C<IO::Uncompress::Unzip> modules.
+ my $gunzip = new IO::Uncompress::Gunzip $gzipFile
+ or die "Cannot gunzip $gzipFile: $GunzipError\n" ;
-The primary focus of the C<IO::Compress::Zip> and C<IO::Uncompress::Unzip>
-modules is to provide an C<IO::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 the C<Archive::Zip> module. You
-can find it on CPAN at
+ bzip2 $gunzip => $bzipFile
+ or die "Cannot bzip2 to $bzipFile: $Bzip2Error\n" ;
- http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz
+Note, there is a limitation of this technique. Some compression file
+formats store extra information along with the compressed data payload. For
+example, gzip can optionally store the original filename and Zip stores a
+lot of information about the original file. If the original compressed file
+contains any of this extra information, it will not be transferred to the
+new compressed file usign the technique above.
+
+=head1 ZIP
+
+=head2 What Compression Types do IO::Compress::Zip & IO::Uncompress::Unzip support?
+
+The following compression formats are supported by C<IO::Compress::Zip> and
+C<IO::Uncompress::Unzip>
+
+=over 5
+
+=item * Store (method 0)
+
+No compression at all.
+
+=item * Deflate (method 8)
+
+This is the default compression used when creating a zip file with
+C<IO::Compress::Zip>.
+
+=item * Bzip2 (method 12)
+
+Only supported if the C<IO-Compress-Bzip2> module is installed.
+
+=item * Lzma (method 14)
+
+Only supported if the C<IO-Compress-Lzma> module is installed.
+
+=back
=head2 Can I Read/Write Zip files larger the 4 Gig?
@@ -134,32 +180,6 @@ In particular, if you are using Info-Zip you need to have zip version 3.x
or better to update a Zip64 archive and unzip version 6.x to read a zip64
archive.
-=head2 What Compression Types do IO::Compress::Zip & IO::Uncompress::Unzip support?
-
-The following compression formats are supported by C<IO::Compress::Zip> and
-C<IO::Uncompress::Unzip>
-
-=over 5
-
-=item * Store (method 0)
-
-NO compression at all.
-
-=item * Deflate (method 8)
-
-This is the default compression used when creating a zip file with
-C<IO::Compress::Zip>.
-
-=item * Bzip2 (method 12)
-
-Only supported if the C<IO-Compress-Bzip2> module is available.
-
-=item * Lzma (method 14)
-
-Only supported if the C<IO-Compress-Lzma> module is available.
-
-=back
-
=head2 Zip Resources
The primary reference for zip files is the "appnote" document available at
@@ -168,63 +188,23 @@ L<http://www.pkware.com/documents/casestudies/APPNOTE.TXT>
An alternatively is the Info-Zip appnote. This is available from
L<ftp://ftp.info-zip.org/pub/infozip/doc/>
-=head2 Compressed files and Net::FTP
+=head1 GZIP
-The C<Net::FTP> module provides two low-level methods called C<stor> and
-C<retr> that both return filehandles. These filehandles can used with the
-C<IO::Compress/Uncompress> modules to compress or uncompress files read
-from or written to an FTP Server on the fly, without having to create a
-temporary file.
-
-Firstly, here is code that uses C<retr> to uncompressed a file as it is
-read from the FTP Server.
-
- use Net::FTP;
- use IO::Uncompress::Gunzip qw(:all);
-
- my $ftp = new Net::FTP ...
-
- my $retr_fh = $ftp->retr($compressed_filename);
- gunzip $retr_fh => $outFilename, AutoClose => 1
- or die "Cannot uncompress '$compressed_file': $GunzipError\n";
-
-and this to compress a file as it is written to the FTP Server
-
- use Net::FTP;
- use IO::Compress::Gzip qw(:all);
+=head2 Gzip Resources
- my $stor_fh = $ftp->stor($filename);
- gzip "filename" => $stor_fh, AutoClose => 1
- or die "Cannot compress '$filename': $GzipError\n";
+The primary reference for gzip files is RFC 1952
+L<http://www.faqs.org/rfcs/rfc1952.html>
-=head2 How do I recompress using a different compression?
+The primary site for gzip is F<http://www.gzip.org>.
-This is easier that you might expect if you realise that all the
-C<IO::Compress::*> objects are derived from C<IO::File> and that all the
-C<IO::Uncompress::*> modules can read from an C<IO::File> filehandle.
+=head1 ZLIB
-So, for example, say you have a file compressed with gzip that you want to
-recompress with bzip2. Here is all that is needed to carry out the
-recompression.
-
- use IO::Uncompress::Gunzip ':all';
- use IO::Compress::Bzip2 ':all';
-
- my $gzipFile = "somefile.gz";
- my $bzipFile = "somefile.bz2";
-
- my $gunzip = new IO::Uncompress::Gunzip $gzipFile
- or die "Cannot gunzip $gzipFile: $GunzipError\n" ;
+=head2 Zlib Resources
- bzip2 $gunzip => $bzipFile
- or die "Cannot bzip2 to $bzipFile: $Bzip2Error\n" ;
+The primary site for the I<zlib> compression library is
+F<http://www.zlib.org>.
-Note, there is a limitation of this technique. Some compression file
-formats store extra information along with the compressed data payload. For
-example, gzip can optionally store the original filename and Zip stores a
-lot of information about the original file. If the original compressed file
-contains any of this extra information, it will not be transferred to the
-new compressed file usign the technique above.
+=head1 HTTP & NETWORK
=head2 Apache::GZip Revisited
@@ -388,6 +368,37 @@ for Content-Encoding you should I<always> use this option. In the example
above it will prevent the filename being included in the gzip header and
make the size of the gzip data stream a slight bit smaller.
+=head2 Compressed files and Net::FTP
+
+The C<Net::FTP> module provides two low-level methods called C<stor> and
+C<retr> that both return filehandles. These filehandles can used with the
+C<IO::Compress/Uncompress> modules to compress or uncompress files read
+from or written to an FTP Server on the fly, without having to create a
+temporary file.
+
+Firstly, here is code that uses C<retr> to uncompressed a file as it is
+read from the FTP Server.
+
+ use Net::FTP;
+ use IO::Uncompress::Gunzip qw(:all);
+
+ my $ftp = new Net::FTP ...
+
+ my $retr_fh = $ftp->retr($compressed_filename);
+ gunzip $retr_fh => $outFilename, AutoClose => 1
+ or die "Cannot uncompress '$compressed_file': $GunzipError\n";
+
+and this to compress a file as it is written to the FTP Server
+
+ use Net::FTP;
+ use IO::Compress::Gzip qw(:all);
+
+ my $stor_fh = $ftp->stor($filename);
+ gzip "filename" => $stor_fh, AutoClose => 1
+ or die "Cannot compress '$filename': $GzipError\n";
+
+=head1 MISC
+
=head2 Using C<InputLength> to uncompress data embedded in a larger file/buffer.
A fairly common use-case is where compressed data is embedded in a larger