Debian Codegraph @

upstream/mageia-cauldron/man3pm/Compress::Zlib.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Compress::Zlib 3pm"
61 .TH Compress::Zlib 3pm 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Compress::Zlib \- Interface to zlib compression library
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& use Compress::Zlib ;
72 \&
73 \& ($d, $status) = deflateInit( [OPT] ) ;
74 \& $status = $d\->deflate($input, $output) ;
75 \& $status = $d\->flush([$flush_type]) ;
76 \& $d\->deflateParams(OPTS) ;
77 \& $d\->deflateTune(OPTS) ;
78 \& $d\->dict_adler() ;
79 \& $d\->crc32() ;
80 \& $d\->adler32() ;
81 \& $d\->total_in() ;
82 \& $d\->total_out() ;
83 \& $d\->msg() ;
84 \& $d\->get_Strategy();
85 \& $d\->get_Level();
86 \& $d\->get_BufSize();
87 \&
88 \& ($i, $status) = inflateInit( [OPT] ) ;
89 \& $status = $i\->inflate($input, $output [, $eof]) ;
90 \& $status = $i\->inflateSync($input) ;
91 \& $i\->dict_adler() ;
92 \& $d\->crc32() ;
93 \& $d\->adler32() ;
94 \& $i\->total_in() ;
95 \& $i\->total_out() ;
96 \& $i\->msg() ;
97 \& $d\->get_BufSize();
98 \&
99 \& $dest = compress($source) ;
100 \& $dest = uncompress($source) ;
101 \&
102 \& $gz = gzopen($filename or filehandle, $mode) ;
103 \& $bytesread = $gz\->gzread($buffer [,$size]) ;
104 \& $bytesread = $gz\->gzreadline($line) ;
105 \& $byteswritten = $gz\->gzwrite($buffer) ;
106 \& $status = $gz\->gzflush($flush) ;
107 \& $offset = $gz\->gztell() ;
108 \& $status = $gz\->gzseek($offset, $whence) ;
109 \& $status = $gz\->gzclose() ;
110 \& $status = $gz\->gzeof() ;
111 \& $status = $gz\->gzsetparams($level, $strategy) ;
112 \& $errstring = $gz\->gzerror() ;
113 \& $gzerrno
114 \&
115 \& $dest = Compress::Zlib::memGzip($buffer) ;
116 \& $dest = Compress::Zlib::memGunzip($buffer) ;
117 \&
118 \& $crc = adler32($buffer [,$crc]) ;
119 \& $crc = crc32($buffer [,$crc]) ;
120 \&
121 \& $crc = crc32_combine($crc1, $crc2, $len2);
122 \& $adler = adler32_combine($adler1, $adler2, $len2);
123 \&
124 \& my $version = Compress::Raw::Zlib::zlib_version();
125 .Ve
126 .SH DESCRIPTION
127 .IX Header "DESCRIPTION"
128 The \fICompress::Zlib\fR module provides a Perl interface to the \fIzlib\fR
129 compression library (see "AUTHOR" for details about where to get
130 \&\fIzlib\fR).
131 .PP
132 The \f(CW\*(C`Compress::Zlib\*(C'\fR module can be split into two general areas of
133 functionality, namely a simple read/write interface to \fIgzip\fR files
134 and a low\-level in\-memory compression/decompression interface.
135 .PP
136 Each of these areas will be discussed in the following sections.
137 .SS "Notes for users of Compress::Zlib version 1"
138 .IX Subsection "Notes for users of Compress::Zlib version 1"
139 The main change in \f(CW\*(C`Compress::Zlib\*(C'\fR version 2.x is that it does not now
140 interface directly to the zlib library. Instead it uses the
141 \&\f(CW\*(C`IO::Compress::Gzip\*(C'\fR and \f(CW\*(C`IO::Uncompress::Gunzip\*(C'\fR modules for
142 reading/writing gzip files, and the \f(CW\*(C`Compress::Raw::Zlib\*(C'\fR module for some
143 low\-level zlib access.
144 .PP
145 The interface provided by version 2 of this module should be 100% backward
146 compatible with version 1. If you find a difference in the expected
147 behaviour please contact the author (See "AUTHOR"). See "GZIP INTERFACE"
148 .PP
149 With the creation of the \f(CW\*(C`IO::Compress\*(C'\fR and \f(CW\*(C`IO::Uncompress\*(C'\fR modules no
150 new features are planned for \f(CW\*(C`Compress::Zlib\*(C'\fR \- the new modules do
151 everything that \f(CW\*(C`Compress::Zlib\*(C'\fR does and then some. Development on
152 \&\f(CW\*(C`Compress::Zlib\*(C'\fR will be limited to bug fixes only.
153 .PP
154 If you are writing new code, your first port of call should be one of the
155 new \f(CW\*(C`IO::Compress\*(C'\fR or \f(CW\*(C`IO::Uncompress\*(C'\fR modules.
156 .SH "GZIP INTERFACE"
157 .IX Header "GZIP INTERFACE"
158 A number of functions are supplied in \fIzlib\fR for reading and writing
159 \&\fIgzip\fR files that conform to RFC 1952. This module provides an interface
160 to most of them.
161 .PP
162 If you have previously used \f(CW\*(C`Compress::Zlib\*(C'\fR 1.x, the following
163 enhancements/changes have been made to the \f(CW\*(C`gzopen\*(C'\fR interface:
164 .IP 1. 5
165 If you want to open either STDIN or STDOUT with \f(CW\*(C`gzopen\*(C'\fR, you can now
166 optionally use the special filename "\f(CW\*(C`\-\*(C'\fR" as a synonym for \f(CW\*(C`\e*STDIN\*(C'\fR and
167 \&\f(CW\*(C`\e*STDOUT\*(C'\fR.
168 .IP 2. 5
169 In \f(CW\*(C`Compress::Zlib\*(C'\fR version 1.x, \f(CW\*(C`gzopen\*(C'\fR used the zlib library to open
170 the underlying file. This made things especially tricky when a Perl
171 filehandle was passed to \f(CW\*(C`gzopen\*(C'\fR. Behind the scenes the numeric C file
172 descriptor had to be extracted from the Perl filehandle and this passed to
173 the zlib library.
174 .Sp
175 Apart from being non\-portable to some operating systems, this made it
176 difficult to use \f(CW\*(C`gzopen\*(C'\fR in situations where you wanted to extract/create
177 a gzip data stream that is embedded in a larger file, without having to
178 resort to opening and closing the file multiple times.
179 .Sp
180 It also made it impossible to pass a perl filehandle that wasn\*(Aqt associated
181 with a real filesystem file, like, say, an \f(CW\*(C`IO::String\*(C'\fR.
182 .Sp
183 In \f(CW\*(C`Compress::Zlib\*(C'\fR version 2.x, the \f(CW\*(C`gzopen\*(C'\fR interface has been
184 completely rewritten to use the IO::Compress::Gzip
185 for writing gzip files and IO::Uncompress::Gunzip
186 for reading gzip files. None of the limitations mentioned above apply.
187 .IP 3. 5
188 Addition of \f(CW\*(C`gzseek\*(C'\fR to provide a restricted \f(CW\*(C`seek\*(C'\fR interface.
189 .IP 4. 5
190 Added \f(CW\*(C`gztell\*(C'\fR.
191 .PP
192 A more complete and flexible interface for reading/writing gzip
193 files/buffers is included with the module \f(CW\*(C`IO\-Compress\-Zlib\*(C'\fR. See
194 IO::Compress::Gzip and
195 IO::Uncompress::Gunzip for more details.
196 .ie n .IP "\fR\fB$gz\fR\fB = gzopen($filename, \fR\fB$mode\fR\fB)\fR" 5
197 .el .IP "\fR\f(CB$gz\fR\fB = gzopen($filename, \fR\f(CB$mode\fR\fB)\fR" 5
198 .IX Item "$gz = gzopen($filename, $mode)"
199 .PD 0
200 .ie n .IP "\fR\fB$gz\fR\fB = gzopen($filehandle, \fR\fB$mode\fR\fB)\fR" 5
201 .el .IP "\fR\f(CB$gz\fR\fB = gzopen($filehandle, \fR\f(CB$mode\fR\fB)\fR" 5
202 .IX Item "$gz = gzopen($filehandle, $mode)"
203 .PD
204 This function opens either the \fIgzip\fR file \f(CW$filename\fR for reading or
205 writing or attaches to the opened filehandle, \f(CW$filehandle\fR.
206 It returns an object on success and \f(CW\*(C`undef\*(C'\fR on failure.
207 .Sp
208 When writing a gzip file this interface will \fIalways\fR create the smallest
209 possible gzip header (exactly 10 bytes). If you want greater control over
210 what gets stored in the gzip header (like the original filename or a
211 comment) use IO::Compress::Gzip instead. Similarly if
212 you want to read the contents of the gzip header use
213 IO::Uncompress::Gunzip.
214 .Sp
215 The second parameter, \f(CW$mode\fR, is used to specify whether the file is
216 opened for reading or writing and to optionally specify a compression
217 level and compression strategy when writing. The format of the \f(CW$mode\fR
218 parameter is similar to the mode parameter to the \*(AqC\*(Aq function \f(CW\*(C`fopen\*(C'\fR,
219 so "rb" is used to open for reading, "wb" for writing and "ab" for
220 appending (writing at the end of the file).
221 .Sp
222 To specify a compression level when writing, append a digit between 0
223 and 9 to the mode string \-\- 0 means no compression and 9 means maximum
224 compression.
225 If no compression level is specified Z_DEFAULT_COMPRESSION is used.
226 .Sp
227 To specify the compression strategy when writing, append \*(Aqf\*(Aq for filtered
228 data, \*(Aqh\*(Aq for Huffman only compression, or \*(AqR\*(Aq for run\-length encoding.
229 If no strategy is specified Z_DEFAULT_STRATEGY is used.
230 .Sp
231 So, for example, "wb9" means open for writing with the maximum compression
232 using the default strategy and "wb4R" means open for writing with compression
233 level 4 and run\-length encoding.
234 .Sp
235 Refer to the \fIzlib\fR documentation for the exact format of the \f(CW$mode\fR
236 parameter.
237 .ie n .IP "\fR\fB$bytesread\fR\fB = \fR\fB$gz\fR\fB\->gzread($buffer [, \fR\fB$size\fR\fB]) ;\fR" 5
238 .el .IP "\fR\f(CB$bytesread\fR\fB = \fR\f(CB$gz\fR\fB\->gzread($buffer [, \fR\f(CB$size\fR\fB]) ;\fR" 5
239 .IX Item "$bytesread = $gz->gzread($buffer [, $size]) ;"
240 Reads \f(CW$size\fR bytes from the compressed file into \f(CW$buffer\fR. If
241 \&\f(CW$size\fR is not specified, it will default to 4096. If the scalar
242 \&\f(CW$buffer\fR is not large enough, it will be extended automatically.
243 .Sp
244 Returns the number of bytes actually read. On EOF it returns 0 and in
245 the case of an error, \-1.
246 .ie n .IP "\fR\fB$bytesread\fR\fB = \fR\fB$gz\fR\fB\->gzreadline($line) ;\fR" 5
247 .el .IP "\fR\f(CB$bytesread\fR\fB = \fR\f(CB$gz\fR\fB\->gzreadline($line) ;\fR" 5
248 .IX Item "$bytesread = $gz->gzreadline($line) ;"
249 Reads the next line from the compressed file into \f(CW$line\fR.
250 .Sp
251 Returns the number of bytes actually read. On EOF it returns 0 and in
252 the case of an error, \-1.
253 .Sp
254 It is legal to intermix calls to \f(CW\*(C`gzread\*(C'\fR and \f(CW\*(C`gzreadline\*(C'\fR.
255 .Sp
256 To maintain backward compatibility with version 1.x of this module
257 \&\f(CW\*(C`gzreadline\*(C'\fR ignores the \f(CW$/\fR variable \- it \fIalways\fR uses the string
258 \&\f(CW"\en"\fR as the line delimiter.
259 .Sp
260 If you want to read a gzip file a line at a time and have it respect the
261 \&\f(CW$/\fR variable (or \f(CW$INPUT_RECORD_SEPARATOR\fR, or \f(CW$RS\fR when \f(CW\*(C`English\*(C'\fR is
262 in use) see IO::Uncompress::Gunzip.
263 .ie n .IP "\fR\fB$byteswritten\fR\fB = \fR\fB$gz\fR\fB\->gzwrite($buffer) ;\fR" 5
264 .el .IP "\fR\f(CB$byteswritten\fR\fB = \fR\f(CB$gz\fR\fB\->gzwrite($buffer) ;\fR" 5
265 .IX Item "$byteswritten = $gz->gzwrite($buffer) ;"
266 Writes the contents of \f(CW$buffer\fR to the compressed file. Returns the
267 number of bytes actually written, or 0 on error.
268 .ie n .IP "\fR\fB$status\fR\fB = \fR\fB$gz\fR\fB\->gzflush($flush_type) ;\fR" 5
269 .el .IP "\fR\f(CB$status\fR\fB = \fR\f(CB$gz\fR\fB\->gzflush($flush_type) ;\fR" 5
270 .IX Item "$status = $gz->gzflush($flush_type) ;"
271 Flushes all pending output into the compressed file.
272 .Sp
273 This method takes an optional parameter, \f(CW$flush_type\fR, that controls
274 how the flushing will be carried out. By default the \f(CW$flush_type\fR
275 used is \f(CW\*(C`Z_FINISH\*(C'\fR. Other valid values for \f(CW$flush_type\fR are
276 \&\f(CW\*(C`Z_NO_FLUSH\*(C'\fR, \f(CW\*(C`Z_SYNC_FLUSH\*(C'\fR, \f(CW\*(C`Z_FULL_FLUSH\*(C'\fR and \f(CW\*(C`Z_BLOCK\*(C'\fR. It is
277 strongly recommended that you only set the \f(CW\*(C`flush_type\*(C'\fR parameter if
278 you fully understand the implications of what it does \- overuse of \f(CW\*(C`flush\*(C'\fR
279 can seriously degrade the level of compression achieved. See the \f(CW\*(C`zlib\*(C'\fR
280 documentation for details.
281 .Sp
282 Returns 0 on success.
283 .ie n .IP "\fR\fB$offset\fR\fB = \fR\fB$gz\fR\fB\->gztell() ;\fR" 5
284 .el .IP "\fR\f(CB$offset\fR\fB = \fR\f(CB$gz\fR\fB\->gztell() ;\fR" 5
285 .IX Item "$offset = $gz->gztell() ;"
286 Returns the uncompressed file offset.
287 .ie n .IP "\fR\fB$status\fR\fB = \fR\fB$gz\fR\fB\->gzseek($offset, \fR\fB$whence\fR\fB) ;\fR" 5
288 .el .IP "\fR\f(CB$status\fR\fB = \fR\f(CB$gz\fR\fB\->gzseek($offset, \fR\f(CB$whence\fR\fB) ;\fR" 5
289 .IX Item "$status = $gz->gzseek($offset, $whence) ;"
290 Provides a sub\-set of the \f(CW\*(C`seek\*(C'\fR functionality, with the restriction
291 that it is only legal to seek forward in the compressed file.
292 It is a fatal error to attempt to seek backward.
293 .Sp
294 When opened for writing, empty parts of the file will have NULL (0x00)
295 bytes written to them.
296 .Sp
297 The \f(CW$whence\fR parameter should be one of SEEK_SET, SEEK_CUR or SEEK_END.
298 .Sp
299 Returns 1 on success, 0 on failure.
300 .ie n .IP \fR\fB$gz\fR\fB\->gzclose\fR 5
301 .el .IP \fR\f(CB$gz\fR\fB\->gzclose\fR 5
302 .IX Item "$gz->gzclose"
303 Closes the compressed file. Any pending data is flushed to the file
304 before it is closed.
305 .Sp
306 Returns 0 on success.
307 .ie n .IP "\fR\fB$gz\fR\fB\->gzsetparams($level, \fR\fB$strategy\fR\fB\fR" 5
308 .el .IP "\fR\f(CB$gz\fR\fB\->gzsetparams($level, \fR\f(CB$strategy\fR\fB\fR" 5
309 .IX Item "$gz->gzsetparams($level, $strategy"
310 Change settings for the deflate stream \f(CW$gz\fR.
311 .Sp
312 The list of the valid options is shown below. Options not specified
313 will remain unchanged.
314 .Sp
315 Note: This method is only available if you are running zlib 1.0.6 or better.
316 .RS 5
317 .ie n .IP \fR\fB$level\fR\fB\fR 5
318 .el .IP \fR\f(CB$level\fR\fB\fR 5
319 .IX Item "$level"
320 Defines the compression level. Valid values are 0 through 9,
321 \&\f(CW\*(C`Z_NO_COMPRESSION\*(C'\fR, \f(CW\*(C`Z_BEST_SPEED\*(C'\fR, \f(CW\*(C`Z_BEST_COMPRESSION\*(C'\fR, and
322 \&\f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR.
323 .ie n .IP \fR\fB$strategy\fR\fB\fR 5
324 .el .IP \fR\f(CB$strategy\fR\fB\fR 5
325 .IX Item "$strategy"
326 Defines the strategy used to tune the compression. The valid values are
327 \&\f(CW\*(C`Z_DEFAULT_STRATEGY\*(C'\fR, \f(CW\*(C`Z_FILTERED\*(C'\fR and \f(CW\*(C`Z_HUFFMAN_ONLY\*(C'\fR.
328 .RE
329 .RS 5
330 .RE
331 .ie n .IP \fR\fB$gz\fR\fB\->gzerror\fR 5
332 .el .IP \fR\f(CB$gz\fR\fB\->gzerror\fR 5
333 .IX Item "$gz->gzerror"
334 Returns the \fIzlib\fR error message or number for the last operation
335 associated with \f(CW$gz\fR. The return value will be the \fIzlib\fR error
336 number when used in a numeric context and the \fIzlib\fR error message
337 when used in a string context. The \fIzlib\fR error number constants,
338 shown below, are available for use.
339 .Sp
340 .Vb 7
341 \& Z_OK
342 \& Z_STREAM_END
343 \& Z_ERRNO
344 \& Z_STREAM_ERROR
345 \& Z_DATA_ERROR
346 \& Z_MEM_ERROR
347 \& Z_BUF_ERROR
348 .Ve
349 .ie n .IP \fR\fB$gzerrno\fR\fB\fR 5
350 .el .IP \fR\f(CB$gzerrno\fR\fB\fR 5
351 .IX Item "$gzerrno"
352 The \f(CW$gzerrno\fR scalar holds the error code associated with the most
353 recent \fIgzip\fR routine. Note that unlike \f(CWgzerror()\fR, the error is
354 \&\fInot\fR associated with a particular file.
355 .Sp
356 As with \f(CWgzerror()\fR it returns an error number in numeric context and
357 an error message in string context. Unlike \f(CWgzerror()\fR though, the
358 error message will correspond to the \fIzlib\fR message when the error is
359 associated with \fIzlib\fR itself, or the UNIX error message when it is
360 not (i.e. \fIzlib\fR returned \f(CW\*(C`Z_ERRORNO\*(C'\fR).
361 .Sp
362 As there is an overlap between the error numbers used by \fIzlib\fR and
363 UNIX, \f(CW$gzerrno\fR should only be used to check for the presence of
364 \&\fIan\fR error in numeric context. Use \f(CWgzerror()\fR to check for specific
365 \&\fIzlib\fR errors. The \fIgzcat\fR example below shows how the variable can
366 be used safely.
367 .SS Examples
368 .IX Subsection "Examples"
369 Here is an example script which uses the interface. It implements a
370 \&\fIgzcat\fR function.
371 .PP
372 .Vb 2
373 \& use strict ;
374 \& use warnings ;
375 \&
376 \& use Compress::Zlib ;
377 \&
378 \& # use stdin if no files supplied
379 \& @ARGV = \*(Aq\-\*(Aq unless @ARGV ;
380 \&
381 \& foreach my $file (@ARGV) {
382 \& my $buffer ;
383 \&
384 \& my $gz = gzopen($file, "rb")
385 \& or die "Cannot open $file: $gzerrno\en" ;
386 \&
387 \& print $buffer while $gz\->gzread($buffer) > 0 ;
388 \&
389 \& die "Error reading from $file: $gzerrno" . ($gzerrno+0) . "\en"
390 \& if $gzerrno != Z_STREAM_END ;
391 \&
392 \& $gz\->gzclose() ;
393 \& }
394 .Ve
395 .PP
396 Below is a script which makes use of \f(CW\*(C`gzreadline\*(C'\fR. It implements a
397 very simple \fIgrep\fR like script.
398 .PP
399 .Vb 2
400 \& use strict ;
401 \& use warnings ;
402 \&
403 \& use Compress::Zlib ;
404 \&
405 \& die "Usage: gzgrep pattern [file...]\en"
406 \& unless @ARGV >= 1;
407 \&
408 \& my $pattern = shift ;
409 \&
410 \& # use stdin if no files supplied
411 \& @ARGV = \*(Aq\-\*(Aq unless @ARGV ;
412 \&
413 \& foreach my $file (@ARGV) {
414 \& my $gz = gzopen($file, "rb")
415 \& or die "Cannot open $file: $gzerrno\en" ;
416 \&
417 \& while ($gz\->gzreadline($_) > 0) {
418 \& print if /$pattern/ ;
419 \& }
420 \&
421 \& die "Error reading from $file: $gzerrno\en"
422 \& if $gzerrno != Z_STREAM_END ;
423 \&
424 \& $gz\->gzclose() ;
425 \& }
426 .Ve
427 .PP
428 This script, \fIgzstream\fR, does the opposite of the \fIgzcat\fR script
429 above. It reads from standard input and writes a gzip data stream to
430 standard output.
431 .PP
432 .Vb 2
433 \& use strict ;
434 \& use warnings ;
435 \&
436 \& use Compress::Zlib ;
437 \&
438 \& binmode STDOUT; # gzopen only sets it on the fd
439 \&
440 \& my $gz = gzopen(\e*STDOUT, "wb")
441 \& or die "Cannot open stdout: $gzerrno\en" ;
442 \&
443 \& while (<>) {
444 \& $gz\->gzwrite($_)
445 \& or die "error writing: $gzerrno\en" ;
446 \& }
447 \&
448 \& $gz\->gzclose ;
449 .Ve
450 .SS Compress::Zlib::memGzip
451 .IX Subsection "Compress::Zlib::memGzip"
452 This function is used to create an in\-memory gzip file with the minimum
453 possible gzip header (exactly 10 bytes).
454 .PP
455 .Vb 2
456 \& $dest = Compress::Zlib::memGzip($buffer)
457 \& or die "Cannot compress: $gzerrno\en";
458 .Ve
459 .PP
460 If successful, it returns the in\-memory gzip file. Otherwise it returns
461 \&\f(CW\*(C`undef\*(C'\fR and the \f(CW$gzerrno\fR variable will store the zlib error code.
462 .PP
463 The \f(CW$buffer\fR parameter can either be a scalar or a scalar reference.
464 .PP
465 See IO::Compress::Gzip for an alternative way to
466 carry out in\-memory gzip compression.
467 .SS Compress::Zlib::memGunzip
468 .IX Subsection "Compress::Zlib::memGunzip"
469 This function is used to uncompress an in\-memory gzip file.
470 .PP
471 .Vb 2
472 \& $dest = Compress::Zlib::memGunzip($buffer)
473 \& or die "Cannot uncompress: $gzerrno\en";
474 .Ve
475 .PP
476 If successful, it returns the uncompressed gzip file. Otherwise it
477 returns \f(CW\*(C`undef\*(C'\fR and the \f(CW$gzerrno\fR variable will store the zlib error
478 code.
479 .PP
480 The \f(CW$buffer\fR parameter can either be a scalar or a scalar reference. The
481 contents of the \f(CW$buffer\fR parameter are destroyed after calling this function.
482 .PP
483 If \f(CW$buffer\fR consists of multiple concatenated gzip data streams only the
484 first will be uncompressed. Use \f(CW\*(C`gunzip\*(C'\fR with the \f(CW\*(C`MultiStream\*(C'\fR option in
485 the \f(CW\*(C`IO::Uncompress::Gunzip\*(C'\fR module if you need to deal with concatenated
486 data streams.
487 .PP
488 See IO::Uncompress::Gunzip for an alternative way
489 to carry out in\-memory gzip uncompression.
490 .SH COMPRESS/UNCOMPRESS
491 .IX Header "COMPRESS/UNCOMPRESS"
492 Two functions are provided to perform in\-memory compression/uncompression of
493 RFC 1950 data streams. They are called \f(CW\*(C`compress\*(C'\fR and \f(CW\*(C`uncompress\*(C'\fR.
494 .ie n .IP "\fR\fB$dest\fR\fB = compress($source [, \fR\fB$level\fR\fB] ) ;\fR" 5
495 .el .IP "\fR\f(CB$dest\fR\fB = compress($source [, \fR\f(CB$level\fR\fB] ) ;\fR" 5
496 .IX Item "$dest = compress($source [, $level] ) ;"
497 Compresses \f(CW$source\fR. If successful it returns the compressed
498 data. Otherwise it returns \fIundef\fR.
499 .Sp
500 The source buffer, \f(CW$source\fR, can either be a scalar or a scalar
501 reference.
502 .Sp
503 The \f(CW$level\fR parameter defines the compression level. Valid values are
504 0 through 9, \f(CW\*(C`Z_NO_COMPRESSION\*(C'\fR, \f(CW\*(C`Z_BEST_SPEED\*(C'\fR,
505 \&\f(CW\*(C`Z_BEST_COMPRESSION\*(C'\fR, and \f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR.
506 If \f(CW$level\fR is not specified \f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR will be used.
507 .ie n .IP "\fR\fB$dest\fR\fB = uncompress($source) ;\fR" 5
508 .el .IP "\fR\f(CB$dest\fR\fB = uncompress($source) ;\fR" 5
509 .IX Item "$dest = uncompress($source) ;"
510 Uncompresses \f(CW$source\fR. If successful it returns the uncompressed
511 data. Otherwise it returns \fIundef\fR.
512 .Sp
513 The source buffer can either be a scalar or a scalar reference.
514 .PP
515 Please note: the two functions defined above are \fInot\fR compatible with
516 the Unix commands of the same name.
517 .PP
518 See IO::Deflate and IO::Inflate included with
519 this distribution for an alternative interface for reading/writing RFC 1950
520 files/buffers.
521 .SH "Deflate Interface"
522 .IX Header "Deflate Interface"
523 This section defines an interface that allows in\-memory compression using
524 the \fIdeflate\fR interface provided by zlib.
525 .PP
526 Here is a definition of the interface available:
527 .ie n .SS "\fB($d, \fP\fB$status\fP\fB) = deflateInit( [OPT] )\fP"
528 .el .SS "\fB($d, \fP\f(CB$status\fP\fB) = deflateInit( [OPT] )\fP"
529 .IX Subsection "($d, $status) = deflateInit( [OPT] )"
530 Initialises a deflation stream.
531 .PP
532 It combines the features of the \fIzlib\fR functions \f(CW\*(C`deflateInit\*(C'\fR,
533 \&\f(CW\*(C`deflateInit2\*(C'\fR and \f(CW\*(C`deflateSetDictionary\*(C'\fR.
534 .PP
535 If successful, it will return the initialised deflation stream, \f(CW$d\fR
536 and \f(CW$status\fR of \f(CW\*(C`Z_OK\*(C'\fR in a list context. In scalar context it
537 returns the deflation stream, \f(CW$d\fR, only.
538 .PP
539 If not successful, the returned deflation stream (\f(CW$d\fR) will be
540 \&\fIundef\fR and \f(CW$status\fR will hold the exact \fIzlib\fR error code.
541 .PP
542 The function optionally takes a number of named options specified as
543 \&\f(CW\*(C`\-Name=>value\*(C'\fR pairs. This allows individual options to be
544 tailored without having to specify them all in the parameter list.
545 .PP
546 For backward compatibility, it is also possible to pass the parameters
547 as a reference to a hash containing the name=>value pairs.
548 .PP
549 The function takes one optional parameter, a reference to a hash. The
550 contents of the hash allow the deflation interface to be tailored.
551 .PP
552 Here is a list of the valid options:
553 .IP \fB\-Level\fR 5
554 .IX Item "-Level"
555 Defines the compression level. Valid values are 0 through 9,
556 \&\f(CW\*(C`Z_NO_COMPRESSION\*(C'\fR, \f(CW\*(C`Z_BEST_SPEED\*(C'\fR, \f(CW\*(C`Z_BEST_COMPRESSION\*(C'\fR, and
557 \&\f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR.
558 .Sp
559 The default is Z_DEFAULT_COMPRESSION.
560 .IP \fB\-Method\fR 5
561 .IX Item "-Method"
562 Defines the compression method. The only valid value at present (and
563 the default) is Z_DEFLATED.
564 .IP \fB\-WindowBits\fR 5
565 .IX Item "-WindowBits"
566 To create an RFC 1950 data stream, set \f(CW\*(C`WindowBits\*(C'\fR to a positive number.
567 .Sp
568 To create an RFC 1951 data stream, set \f(CW\*(C`WindowBits\*(C'\fR to \f(CW\*(C`\-MAX_WBITS\*(C'\fR.
569 .Sp
570 For a full definition of the meaning and valid values for \f(CW\*(C`WindowBits\*(C'\fR refer
571 to the \fIzlib\fR documentation for \fIdeflateInit2\fR.
572 .Sp
573 Defaults to MAX_WBITS.
574 .IP \fB\-MemLevel\fR 5
575 .IX Item "-MemLevel"
576 For a definition of the meaning and valid values for \f(CW\*(C`MemLevel\*(C'\fR
577 refer to the \fIzlib\fR documentation for \fIdeflateInit2\fR.
578 .Sp
579 Defaults to MAX_MEM_LEVEL.
580 .IP \fB\-Strategy\fR 5
581 .IX Item "-Strategy"
582 Defines the strategy used to tune the compression. The valid values are
583 \&\f(CW\*(C`Z_DEFAULT_STRATEGY\*(C'\fR, \f(CW\*(C`Z_FILTERED\*(C'\fR and \f(CW\*(C`Z_HUFFMAN_ONLY\*(C'\fR.
584 .Sp
585 The default is Z_DEFAULT_STRATEGY.
586 .IP \fB\-Dictionary\fR 5
587 .IX Item "-Dictionary"
588 When a dictionary is specified \fICompress::Zlib\fR will automatically
589 call \f(CW\*(C`deflateSetDictionary\*(C'\fR directly after calling \f(CW\*(C`deflateInit\*(C'\fR. The
590 Adler32 value for the dictionary can be obtained by calling the method
591 \&\f(CW\*(C`$d\->dict_adler()\*(C'\fR.
592 .Sp
593 The default is no dictionary.
594 .IP \fB\-Bufsize\fR 5
595 .IX Item "-Bufsize"
596 Sets the initial size for the deflation buffer. If the buffer has to be
597 reallocated to increase the size, it will grow in increments of
598 \&\f(CW\*(C`Bufsize\*(C'\fR.
599 .Sp
600 The default is 4096.
601 .PP
602 Here is an example of using the \f(CW\*(C`deflateInit\*(C'\fR optional parameter list
603 to override the default buffer size and compression level. All other
604 options will take their default values.
605 .PP
606 .Vb 2
607 \& deflateInit( \-Bufsize => 300,
608 \& \-Level => Z_BEST_SPEED ) ;
609 .Ve
610 .ie n .SS "\fB($out, \fP\fB$status\fP\fB) = \fP\fB$d\fP\fB\->deflate($buffer)\fP"
611 .el .SS "\fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$d\fP\fB\->deflate($buffer)\fP"
612 .IX Subsection "($out, $status) = $d->deflate($buffer)"
613 Deflates the contents of \f(CW$buffer\fR. The buffer can either be a scalar
614 or a scalar reference. When finished, \f(CW$buffer\fR will be
615 completely processed (assuming there were no errors). If the deflation
616 was successful it returns the deflated output, \f(CW$out\fR, and a status
617 value, \f(CW$status\fR, of \f(CW\*(C`Z_OK\*(C'\fR.
618 .PP
619 On error, \f(CW$out\fR will be \fIundef\fR and \f(CW$status\fR will contain the
620 \&\fIzlib\fR error code.
621 .PP
622 In a scalar context \f(CW\*(C`deflate\*(C'\fR will return \f(CW$out\fR only.
623 .PP
624 As with the \fIdeflate\fR function in \fIzlib\fR, it is not necessarily the
625 case that any output will be produced by this method. So don\*(Aqt rely on
626 the fact that \f(CW$out\fR is empty for an error test.
627 .ie n .SS "\fB($out, \fP\fB$status\fP\fB) = \fP\fB$d\fP\fB\->flush()\fP =head2 \fB($out, \fP\fB$status\fP\fB) = \fP\fB$d\fP\fB\->flush($flush_type)\fP"
628 .el .SS "\fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$d\fP\fB\->flush()\fP =head2 \fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$d\fP\fB\->flush($flush_type)\fP"
629 .IX Subsection "($out, $status) = $d->flush() =head2 ($out, $status) = $d->flush($flush_type)"
630 Typically used to finish the deflation. Any pending output will be
631 returned via \f(CW$out\fR.
632 \&\f(CW$status\fR will have a value \f(CW\*(C`Z_OK\*(C'\fR if successful.
633 .PP
634 In a scalar context \f(CW\*(C`flush\*(C'\fR will return \f(CW$out\fR only.
635 .PP
636 Note that flushing can seriously degrade the compression ratio, so it
637 should only be used to terminate a decompression (using \f(CW\*(C`Z_FINISH\*(C'\fR) or
638 when you want to create a \fIfull flush point\fR (using \f(CW\*(C`Z_FULL_FLUSH\*(C'\fR).
639 .PP
640 By default the \f(CW\*(C`flush_type\*(C'\fR used is \f(CW\*(C`Z_FINISH\*(C'\fR. Other valid values
641 for \f(CW\*(C`flush_type\*(C'\fR are \f(CW\*(C`Z_NO_FLUSH\*(C'\fR, \f(CW\*(C`Z_PARTIAL_FLUSH\*(C'\fR, \f(CW\*(C`Z_SYNC_FLUSH\*(C'\fR
642 and \f(CW\*(C`Z_FULL_FLUSH\*(C'\fR. It is strongly recommended that you only set the
643 \&\f(CW\*(C`flush_type\*(C'\fR parameter if you fully understand the implications of
644 what it does. See the \f(CW\*(C`zlib\*(C'\fR documentation for details.
645 .ie n .SS "\fB\fP\fB$status\fP\fB = \fP\fB$d\fP\fB\->deflateParams([OPT])\fP"
646 .el .SS "\fB\fP\f(CB$status\fP\fB = \fP\f(CB$d\fP\fB\->deflateParams([OPT])\fP"
647 .IX Subsection "$status = $d->deflateParams([OPT])"
648 Change settings for the deflate stream \f(CW$d\fR.
649 .PP
650 The list of the valid options is shown below. Options not specified
651 will remain unchanged.
652 .IP \fB\-Level\fR 5
653 .IX Item "-Level"
654 Defines the compression level. Valid values are 0 through 9,
655 \&\f(CW\*(C`Z_NO_COMPRESSION\*(C'\fR, \f(CW\*(C`Z_BEST_SPEED\*(C'\fR, \f(CW\*(C`Z_BEST_COMPRESSION\*(C'\fR, and
656 \&\f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR.
657 .IP \fB\-Strategy\fR 5
658 .IX Item "-Strategy"
659 Defines the strategy used to tune the compression. The valid values are
660 \&\f(CW\*(C`Z_DEFAULT_STRATEGY\*(C'\fR, \f(CW\*(C`Z_FILTERED\*(C'\fR and \f(CW\*(C`Z_HUFFMAN_ONLY\*(C'\fR.
661 .ie n .SS \fB\fP\fB$d\fP\fB\->dict_adler()\fP
662 .el .SS \fB\fP\f(CB$d\fP\fB\->dict_adler()\fP
663 .IX Subsection "$d->dict_adler()"
664 Returns the adler32 value for the dictionary.
665 .ie n .SS \fB\fP\fB$d\fP\fB\->msg()\fP
666 .el .SS \fB\fP\f(CB$d\fP\fB\->msg()\fP
667 .IX Subsection "$d->msg()"
668 Returns the last error message generated by zlib.
669 .ie n .SS \fB\fP\fB$d\fP\fB\->total_in()\fP
670 .el .SS \fB\fP\f(CB$d\fP\fB\->total_in()\fP
671 .IX Subsection "$d->total_in()"
672 Returns the total number of bytes uncompressed bytes input to deflate.
673 .ie n .SS \fB\fP\fB$d\fP\fB\->total_out()\fP
674 .el .SS \fB\fP\f(CB$d\fP\fB\->total_out()\fP
675 .IX Subsection "$d->total_out()"
676 Returns the total number of compressed bytes output from deflate.
677 .SS Example
678 .IX Subsection "Example"
679 Here is a trivial example of using \f(CW\*(C`deflate\*(C'\fR. It simply reads standard
680 input, deflates it and writes it to standard output.
681 .PP
682 .Vb 2
683 \& use strict ;
684 \& use warnings ;
685 \&
686 \& use Compress::Zlib ;
687 \&
688 \& binmode STDIN;
689 \& binmode STDOUT;
690 \& my $x = deflateInit()
691 \& or die "Cannot create a deflation stream\en" ;
692 \&
693 \& my ($output, $status) ;
694 \& while (<>)
695 \& {
696 \& ($output, $status) = $x\->deflate($_) ;
697 \&
698 \& $status == Z_OK
699 \& or die "deflation failed\en" ;
700 \&
701 \& print $output ;
702 \& }
703 \&
704 \& ($output, $status) = $x\->flush() ;
705 \&
706 \& $status == Z_OK
707 \& or die "deflation failed\en" ;
708 \&
709 \& print $output ;
710 .Ve
711 .SH "Inflate Interface"
712 .IX Header "Inflate Interface"
713 This section defines the interface available that allows in\-memory
714 uncompression using the \fIdeflate\fR interface provided by zlib.
715 .PP
716 Here is a definition of the interface:
717 .ie n .SS "\fB($i, \fP\fB$status\fP\fB) = inflateInit()\fP"
718 .el .SS "\fB($i, \fP\f(CB$status\fP\fB) = inflateInit()\fP"
719 .IX Subsection "($i, $status) = inflateInit()"
720 Initialises an inflation stream.
721 .PP
722 In a list context it returns the inflation stream, \f(CW$i\fR, and the
723 \&\fIzlib\fR status code in \f(CW$status\fR. In a scalar context it returns the
724 inflation stream only.
725 .PP
726 If successful, \f(CW$i\fR will hold the inflation stream and \f(CW$status\fR will
727 be \f(CW\*(C`Z_OK\*(C'\fR.
728 .PP
729 If not successful, \f(CW$i\fR will be \fIundef\fR and \f(CW$status\fR will hold the
730 \&\fIzlib\fR error code.
731 .PP
732 The function optionally takes a number of named options specified as
733 \&\f(CW\*(C`\-Name=>value\*(C'\fR pairs. This allows individual options to be
734 tailored without having to specify them all in the parameter list.
735 .PP
736 For backward compatibility, it is also possible to pass the parameters
737 as a reference to a hash containing the name=>value pairs.
738 .PP
739 The function takes one optional parameter, a reference to a hash. The
740 contents of the hash allow the deflation interface to be tailored.
741 .PP
742 Here is a list of the valid options:
743 .IP \fB\-WindowBits\fR 5
744 .IX Item "-WindowBits"
745 To uncompress an RFC 1950 data stream, set \f(CW\*(C`WindowBits\*(C'\fR to a positive number.
746 .Sp
747 To uncompress an RFC 1951 data stream, set \f(CW\*(C`WindowBits\*(C'\fR to \f(CW\*(C`\-MAX_WBITS\*(C'\fR.
748 .Sp
749 For a full definition of the meaning and valid values for \f(CW\*(C`WindowBits\*(C'\fR refer
750 to the \fIzlib\fR documentation for \fIinflateInit2\fR.
751 .Sp
752 Defaults to MAX_WBITS.
753 .IP \fB\-Bufsize\fR 5
754 .IX Item "-Bufsize"
755 Sets the initial size for the inflation buffer. If the buffer has to be
756 reallocated to increase the size, it will grow in increments of
757 \&\f(CW\*(C`Bufsize\*(C'\fR.
758 .Sp
759 Default is 4096.
760 .IP \fB\-Dictionary\fR 5
761 .IX Item "-Dictionary"
762 The default is no dictionary.
763 .PP
764 Here is an example of using the \f(CW\*(C`inflateInit\*(C'\fR optional parameter to
765 override the default buffer size.
766 .PP
767 .Vb 1
768 \& inflateInit( \-Bufsize => 300 ) ;
769 .Ve
770 .ie n .SS "\fB($out, \fP\fB$status\fP\fB) = \fP\fB$i\fP\fB\->inflate($buffer)\fP"
771 .el .SS "\fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$i\fP\fB\->inflate($buffer)\fP"
772 .IX Subsection "($out, $status) = $i->inflate($buffer)"
773 Inflates the complete contents of \f(CW$buffer\fR. The buffer can either be
774 a scalar or a scalar reference.
775 .PP
776 Returns \f(CW\*(C`Z_OK\*(C'\fR if successful and \f(CW\*(C`Z_STREAM_END\*(C'\fR if the end of the
777 compressed data has been successfully reached.
778 If not successful, \f(CW$out\fR will be \fIundef\fR and \f(CW$status\fR will hold
779 the \fIzlib\fR error code.
780 .PP
781 The \f(CW$buffer\fR parameter is modified by \f(CW\*(C`inflate\*(C'\fR. On completion it
782 will contain what remains of the input buffer after inflation. This
783 means that \f(CW$buffer\fR will be an empty string when the return status is
784 \&\f(CW\*(C`Z_OK\*(C'\fR. When the return status is \f(CW\*(C`Z_STREAM_END\*(C'\fR the \f(CW$buffer\fR
785 parameter will contains what (if anything) was stored in the input
786 buffer after the deflated data stream.
787 .PP
788 This feature is useful when processing a file format that encapsulates
789 a compressed data stream (e.g. gzip, zip).
790 .ie n .SS "\fB\fP\fB$status\fP\fB = \fP\fB$i\fP\fB\->inflateSync($buffer)\fP"
791 .el .SS "\fB\fP\f(CB$status\fP\fB = \fP\f(CB$i\fP\fB\->inflateSync($buffer)\fP"
792 .IX Subsection "$status = $i->inflateSync($buffer)"
793 Scans \f(CW$buffer\fR until it reaches either a \fIfull flush point\fR or the
794 end of the buffer.
795 .PP
796 If a \fIfull flush point\fR is found, \f(CW\*(C`Z_OK\*(C'\fR is returned and \f(CW$buffer\fR
797 will be have all data up to the flush point removed. This can then be
798 passed to the \f(CW\*(C`deflate\*(C'\fR method.
799 .PP
800 Any other return code means that a flush point was not found. If more
801 data is available, \f(CW\*(C`inflateSync\*(C'\fR can be called repeatedly with more
802 compressed data until the flush point is found.
803 .ie n .SS \fB\fP\fB$i\fP\fB\->dict_adler()\fP
804 .el .SS \fB\fP\f(CB$i\fP\fB\->dict_adler()\fP
805 .IX Subsection "$i->dict_adler()"
806 Returns the adler32 value for the dictionary.
807 .ie n .SS \fB\fP\fB$i\fP\fB\->msg()\fP
808 .el .SS \fB\fP\f(CB$i\fP\fB\->msg()\fP
809 .IX Subsection "$i->msg()"
810 Returns the last error message generated by zlib.
811 .ie n .SS \fB\fP\fB$i\fP\fB\->total_in()\fP
812 .el .SS \fB\fP\f(CB$i\fP\fB\->total_in()\fP
813 .IX Subsection "$i->total_in()"
814 Returns the total number of bytes compressed bytes input to inflate.
815 .ie n .SS \fB\fP\fB$i\fP\fB\->total_out()\fP
816 .el .SS \fB\fP\f(CB$i\fP\fB\->total_out()\fP
817 .IX Subsection "$i->total_out()"
818 Returns the total number of uncompressed bytes output from inflate.
819 .SS Example
820 .IX Subsection "Example"
821 Here is an example of using \f(CW\*(C`inflate\*(C'\fR.
822 .PP
823 .Vb 2
824 \& use strict ;
825 \& use warnings ;
826 \&
827 \& use Compress::Zlib ;
828 \&
829 \& my $x = inflateInit()
830 \& or die "Cannot create a inflation stream\en" ;
831 \&
832 \& my $input = \*(Aq\*(Aq ;
833 \& binmode STDIN;
834 \& binmode STDOUT;
835 \&
836 \& my ($output, $status) ;
837 \& while (read(STDIN, $input, 4096))
838 \& {
839 \& ($output, $status) = $x\->inflate(\e$input) ;
840 \&
841 \& print $output
842 \& if $status == Z_OK or $status == Z_STREAM_END ;
843 \&
844 \& last if $status != Z_OK ;
845 \& }
846 \&
847 \& die "inflation failed\en"
848 \& unless $status == Z_STREAM_END ;
849 .Ve
850 .SH "CHECKSUM FUNCTIONS"
851 .IX Header "CHECKSUM FUNCTIONS"
852 Two functions are provided by \fIzlib\fR to calculate checksums. For the
853 Perl interface, the order of the two parameters in both functions has
854 been reversed. This allows both running checksums and one off
855 calculations to be done.
856 .PP
857 .Vb 2
858 \& $crc = adler32($buffer [,$crc]) ;
859 \& $crc = crc32($buffer [,$crc]) ;
860 .Ve
861 .PP
862 The buffer parameters can either be a scalar or a scalar reference.
863 .PP
864 If the \f(CW$crc\fR parameters is \f(CW\*(C`undef\*(C'\fR, the crc value will be reset.
865 .PP
866 If you have built this module with zlib 1.2.3 or better, two more
867 CRC\-related functions are available.
868 .PP
869 .Vb 2
870 \& $crc = crc32_combine($crc1, $crc2, $len2);
871 \& $adler = adler32_combine($adler1, $adler2, $len2);
872 .Ve
873 .PP
874 These functions allow checksums to be merged.
875 Refer to the \fIzlib\fR documentation for more details.
876 .SH Misc
877 .IX Header "Misc"
878 .ie n .SS "my $version = \fBCompress::Zlib::zlib_version()\fP;"
879 .el .SS "my \f(CW$version\fP = \fBCompress::Zlib::zlib_version()\fP;"
880 .IX Subsection "my $version = Compress::Zlib::zlib_version();"
881 Returns the version of the zlib library.
882 .SH CONSTANTS
883 .IX Header "CONSTANTS"
884 All the \fIzlib\fR constants are automatically imported when you make use
885 of \fICompress::Zlib\fR.
886 .SH SUPPORT
887 .IX Header "SUPPORT"
888 General feedback/questions/bug reports should be sent to
889 <https://github.com/pmqs/IO\-Compress/issues> (preferred) or
890 <https://rt.cpan.org/Public/Dist/Display.html?Name=IO\-Compress>.
891 .SH "SEE ALSO"
892 .IX Header "SEE ALSO"
893 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::Lzma, IO::Uncompress::UnLzma, IO::Compress::Xz, IO::Uncompress::UnXz, IO::Compress::Lzip, IO::Uncompress::UnLzip, IO::Compress::Lzop, IO::Uncompress::UnLzop, IO::Compress::Lzf, IO::Uncompress::UnLzf, IO::Compress::Zstd, IO::Uncompress::UnZstd, IO::Uncompress::AnyInflate, IO::Uncompress::AnyUncompress
894 .PP
895 IO::Compress::FAQ
896 .PP
897 File::GlobMapper, Archive::Zip,
898 Archive::Tar,
899 IO::Zlib
900 .PP
901 For RFC 1950, 1951 and 1952 see
902 <https://datatracker.ietf.org/doc/html/rfc1950>,
903 <https://datatracker.ietf.org/doc/html/rfc1951> and
904 <https://datatracker.ietf.org/doc/html/rfc1952>
905 .PP
906 The \fIzlib\fR compression library was written by Jean\-loup Gailly
907 \&\f(CW\*(C`[email protected]\*(C'\fR and Mark Adler \f(CW\*(C`[email protected]\*(C'\fR.
908 .PP
909 The primary site for the \fIzlib\fR compression library is
910 <http://www.zlib.org>.
911 .PP
912 The primary site for the \fIzlib\-ng\fR compression library is
913 <https://github.com/zlib\-ng/zlib\-ng>.
914 .PP
915 The primary site for gzip is <http://www.gzip.org>.
916 .SH AUTHOR
917 .IX Header "AUTHOR"
918 This module was written by Paul Marquess, \f(CW\*(C`[email protected]\*(C'\fR.
919 .SH "MODIFICATION HISTORY"
920 .IX Header "MODIFICATION HISTORY"
921 See the Changes file.
922 .SH "COPYRIGHT AND LICENSE"
923 .IX Header "COPYRIGHT AND LICENSE"
924 Copyright (c) 1995\-2024 Paul Marquess. All rights reserved.
925 .PP
926 This program is free software; you can redistribute it and/or
927 modify it under the same terms as Perl itself.