Update Compression modules to version 2.009
[p5sagit/p5-mst-13.2.git] / ext / Compress / Zlib / pod / FAQ.pod
1
2 =head1 NAME
3
4 Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib
5
6 =head1 DESCRIPTION
7
8 Common questions answered.
9
10 =head2 Compatibility with Unix compress/uncompress.
11
12 Although C<Compress::Zlib> has a pair of functions called C<compress> and
13 C<uncompress>, they are I<not> related to the Unix programs of the same
14 name. The C<Compress::Zlib> module is not compatible with Unix
15 C<compress>.
16
17 If you have the C<uncompress> program available, you can use this to read
18 compressed files
19
20     open F, "uncompress -c $filename |";
21     while (<F>)
22     {
23         ...
24
25 Alternatively, if you have the C<gunzip> program available, you can use
26 this to read compressed files
27
28     open F, "gunzip -c $filename |";
29     while (<F>)
30     {
31         ...
32
33 and this to write compress files, if you have the C<compress> program
34 available
35
36     open F, "| compress -c $filename ";
37     print F "data";
38     ...
39     close F ;
40
41 =head2 Accessing .tar.Z files
42
43 The C<Archive::Tar> module can optionally use C<Compress::Zlib> (via the
44 C<IO::Zlib> module) to access tar files that have been compressed with
45 C<gzip>. Unfortunately tar files compressed with the Unix C<compress>
46 utility cannot be read by C<Compress::Zlib> and so cannot be directly
47 accessed by C<Archive::Tar>.
48
49 If the C<uncompress> or C<gunzip> programs are available, you can use one
50 of these workarounds to read C<.tar.Z> files from C<Archive::Tar>
51
52 Firstly with C<uncompress>
53
54     use strict;
55     use warnings;
56     use Archive::Tar;
57
58     open F, "uncompress -c $filename |";
59     my $tar = Archive::Tar->new(*F);
60     ...
61
62 and this with C<gunzip>
63
64     use strict;
65     use warnings;
66     use Archive::Tar;
67
68     open F, "gunzip -c $filename |";
69     my $tar = Archive::Tar->new(*F);
70     ...
71
72 Similarly, if the C<compress> program is available, you can use this to
73 write a C<.tar.Z> file
74
75     use strict;
76     use warnings;
77     use Archive::Tar;
78     use IO::File;
79
80     my $fh = new IO::File "| compress -c >$filename";
81     my $tar = Archive::Tar->new();
82     ...
83     $tar->write($fh);
84     $fh->close ;
85
86 =head2 Accessing Zip Files
87
88 This module does not support reading/writing zip files.
89
90 Support for reading/writing zip files is included with the
91 C<IO::Compress::Zip> and C<IO::Uncompress::Unzip> modules.
92
93 The primary focus of the C<IO::Compress::Zip> and C<IO::Uncompress::Unzip>
94 modules is to provide an C<IO::File> compatible streaming read/write
95 interface to zip files/buffers. They are not fully flegged archivers. If
96 you are looking for an archiver check out the C<Archive::Zip> module. You
97 can find it on CPAN at 
98
99     http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz    
100
101 =head1 SEE ALSO
102
103 L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
104
105 L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
106
107 L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
108 L<Archive::Tar|Archive::Tar>,
109 L<IO::Zlib|IO::Zlib>
110
111 =head1 AUTHOR
112
113 This module was written by Paul Marquess, F<pmqs@cpan.org>. 
114
115 =head1 MODIFICATION HISTORY
116
117 See the Changes file.
118
119 =head1 COPYRIGHT AND LICENSE
120
121 Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
122
123 This program is free software; you can redistribute it and/or
124 modify it under the same terms as Perl itself.
125