Fix use of a variable before it is initialised, introduced by change
[p5sagit/p5-mst-13.2.git] / ext / Compress / Zlib / pod / FAQ.pod
CommitLineData
d54256af 1
2=head1 NAME
3
4Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib
5
6=head1 DESCRIPTION
7
8Common questions answered.
9
10=head2 Compatibility with Unix compress/uncompress.
11
12Although C<Compress::Zlib> has a pair of functions called C<compress> and
13C<uncompress>, they are I<not> related to the Unix programs of the same
14name. The C<Compress::Zlib> module is not compatible with Unix
15C<compress>.
16
17If you have the C<uncompress> program available, you can use this to read
18compressed files
19
20 open F, "uncompress -c $filename |";
21 while (<F>)
22 {
23 ...
24
25Alternatively, if you have the C<gunzip> program available, you can use
26this to read compressed files
27
28 open F, "gunzip -c $filename |";
29 while (<F>)
30 {
31 ...
32
33and this to write compress files, if you have the C<compress> program
34available
35
36 open F, "| compress -c $filename ";
37 print F "data";
38 ...
39 close F ;
40
41=head2 Accessing .tar.Z files
42
43The C<Archive::Tar> module can optionally use C<Compress::Zlib> (via the
44C<IO::Zlib> module) to access tar files that have been compressed with
45C<gzip>. Unfortunately tar files compressed with the Unix C<compress>
46utility cannot be read by C<Compress::Zlib> and so cannot be directly
47accessed by C<Archive::Tar>.
48
49If the C<uncompress> or C<gunzip> programs are available, you can use one
50of these workarounds to read C<.tar.Z> files from C<Archive::Tar>
51
52Firstly 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
62and 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
72Similarly, if the C<compress> program is available, you can use this to
73write 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
88This module does not support reading/writing zip files.
89
90Support for reading/writing zip files is included with the
91C<IO::Compress::Zip> and C<IO::Uncompress::Unzip> modules.
92
93The primary focus of the C<IO::Compress::Zip> and C<IO::Uncompress::Unzip>
94modules is to provide an C<IO::File> compatible streaming read/write
95interface to zip files/buffers. They are not fully flegged archivers. If
96you are looking for an archiver check out the C<Archive::Zip> module. You
97can 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
103L<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
105L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
106
107L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
108L<Archive::Tar|Archive::Tar>,
109L<IO::Zlib|IO::Zlib>
110
111=head1 AUTHOR
112
113This module was written by Paul Marquess, F<pmqs@cpan.org>.
114
115=head1 MODIFICATION HISTORY
116
117See the Changes file.
118
119=head1 COPYRIGHT AND LICENSE
120
121Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
122
123This program is free software; you can redistribute it and/or
124modify it under the same terms as Perl itself.
125