Avoid possible dereference of NULL in the initialization of PL_origalen.
[p5sagit/p5-mst-13.2.git] / ext / Compress / Zlib / pod / FAQ.pod
CommitLineData
642e522c 1
2=head1 NAME
3
4Compress::Zlib::FAQ -- Frequently Asked Questions about Compress::Zlib
5
6=head1 DESCRIPTION
7
8Common questions answered.
9
10
11
12=head2 Compatibility with Unix compress/uncompress.
13
14Although C<Compress::Zlib> has a pair of functions called C<compress>
15and C<uncompress>, they are I<not> the same as the Unix programs of the
16same name. The C<Compress::Zlib> library is not compatible with Unix
17C<compress>.
18
19If you have the C<uncompress> program available, you can use this to
20read compressed files
21
22 open F, "uncompress -c $filename |";
23 while (<F>)
24 {
25 ...
26
27If you have the C<gunzip> program available, you can use this to read
28compressed files
29
30 open F, "gunzip -c $filename |";
31 while (<F>)
32 {
33 ...
34
35and this to write compress files if you have the C<compress> program
36available
37
38 open F, "| compress -c $filename ";
39 print F "data";
40 ...
41 close F ;
42
43=head2 Accessing .tar.Z files
44
45The C<Archive::Tar> module can optionally use C<Compress::Zlib> (via
46the C<IO::Zlib> module) to access tar files that have been compressed
47with C<gzip>. Unfortunately tar files compressed with the Unix C<compress>
48utility cannot be read by C<Compress::Zlib> and so cannot be directly
49accesses by C<Archive::Tar>.
50
51If the C<uncompress> or C<gunzip> programs are available, you can use
52one of these workarounds to read C<.tar.Z> files from C<Archive::Tar>
53
54Firstly with C<uncompress>
55
56 use strict;
57 use warnings;
58 use Archive::Tar;
59
60 open F, "uncompress -c $filename |";
61 my $tar = Archive::Tar->new(*F);
62 ...
63
64and this with C<gunzip>
65
66 use strict;
67 use warnings;
68 use Archive::Tar;
69
70 open F, "gunzip -c $filename |";
71 my $tar = Archive::Tar->new(*F);
72 ...
73
74Similarly, if the C<compress> program is available, you can use this to
75write a C<.tar.Z> file
76
77 use strict;
78 use warnings;
79 use Archive::Tar;
80 use IO::File;
81
82 my $fh = new IO::File "| compress -c >$filename";
83 my $tar = Archive::Tar->new();
84 ...
85 $tar->write($fh);
86 $fh->close ;
87
88
89=head2 Accessing Zip Files
90
91Although it is possible (with some effort on your part) to use this
92module to access .zip files, there is a module on CPAN that will do all
93the hard work for you. Check out the C<Archive::Zip> module on CPAN at
94
95 http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz
96
97Assuming you don't want to use this module to access zip files there
98are a number of undocumented features in the zlib library you need to
99be aware of.
100
101=over 5
102
103=item 1.
104
105When calling B<inflateInit> or B<deflateInit> the B<WindowBits> parameter
106must be set to C<-MAX_WBITS>. This disables the creation of the zlib
107header.
108
109=item 2.
110
111The zlib function B<inflate>, and so the B<inflate> method supplied in
112this module, assume that there is at least one trailing byte after the
113compressed data stream. Normally this isn't a problem because both
114the gzip and zip file formats will guarantee that there is data directly
115after the compressed data stream.
116
117=back
118
119
120
121
122
123
124
125
126
127
128
129
130=head2 Zlib Library Version Support
131
132By default C<Compress::Zlib> will build with a private copy of version 1.2.3 of the zlib library. (See the F<README> file for details of how
133to override this behavior)
134
135If you decide to use a different version of the zlib library, you need to be
136aware of the following issues
137
138=over 5
139
140=item *
141
142First off, you must have zlib 1.0.5 or better.
143
144=item *
145
146You need to have zlib 1.2.1 or better if you want to use the C<-Merge> option
147with C<IO::Compress::Gzip>, C<IO::Compress::Deflate> and C<IO::Compress::RawDeflate>.
148
149
150
151=back
152
153
154
155
156=head1 SEE ALSO
157
158L<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::Uncompress::AnyInflate>
159
160L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
161
162L<File::GlobMapper|File::GlobMapper>, L<Archive::Tar|Archive::Zip>,
163L<IO::Zlib|IO::Zlib>
164
165For RFC 1950, 1951 and 1952 see
166F<http://www.faqs.org/rfcs/rfc1950.html>,
167F<http://www.faqs.org/rfcs/rfc1951.html> and
168F<http://www.faqs.org/rfcs/rfc1952.html>
169
170The primary site for the gzip program is F<http://www.gzip.org>.
171
172=head1 AUTHOR
173
174The I<> module was written by Paul Marquess,
175F<pmqs@cpan.org>. The latest copy of the module can be
176found on CPAN in F<modules/by-module/Compress/Compress-Zlib-x.x.tar.gz>.
177
178The I<zlib> compression library was written by Jean-loup Gailly
179F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
180
181The primary site for the I<zlib> compression library is
182F<http://www.zlib.org>.
183
184=head1 MODIFICATION HISTORY
185
186See the Changes file.
187
188=head1 COPYRIGHT AND LICENSE
189
190
191Copyright (c) 2005 Paul Marquess. All rights reserved.
192This program is free software; you can redistribute it and/or
193modify it under the same terms as Perl itself.
194
195
196
197
198