Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "Zlib 3" | |
132 | .TH Zlib 3 "2004-09-16" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Compress::Zlib \- Interface to zlib compression library | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& use Compress::Zlib ; | |
139 | .Ve | |
140 | .PP | |
141 | .Vb 8 | |
142 | \& ($d, $status) = deflateInit( [OPT] ) ; | |
143 | \& ($out, $status) = $d->deflate($buffer) ; | |
144 | \& $status = $d->deflateParams([OPT]) ; | |
145 | \& ($out, $status) = $d->flush() ; | |
146 | \& $d->dict_adler() ; | |
147 | \& $d->total_in() ; | |
148 | \& $d->total_out() ; | |
149 | \& $d->msg() ; | |
150 | .Ve | |
151 | .PP | |
152 | .Vb 7 | |
153 | \& ($i, $status) = inflateInit( [OPT] ) ; | |
154 | \& ($out, $status) = $i->inflate($buffer) ; | |
155 | \& $status = $i->inflateSync($buffer) ; | |
156 | \& $i->dict_adler() ; | |
157 | \& $i->total_in() ; | |
158 | \& $i->total_out() ; | |
159 | \& $i->msg() ; | |
160 | .Ve | |
161 | .PP | |
162 | .Vb 2 | |
163 | \& $dest = compress($source, [$level]) ; | |
164 | \& $dest = uncompress($source) ; | |
165 | .Ve | |
166 | .PP | |
167 | .Vb 10 | |
168 | \& $gz = gzopen($filename or filehandle, $mode) ; | |
169 | \& $bytesread = $gz->gzread($buffer [,$size]) ; | |
170 | \& $bytesread = $gz->gzreadline($line) ; | |
171 | \& $byteswritten = $gz->gzwrite($buffer) ; | |
172 | \& $status = $gz->gzflush($flush) ; | |
173 | \& $status = $gz->gzclose() ; | |
174 | \& $status = $gz->gzeof() ; | |
175 | \& $status = $gz->gzsetparams($level, $strategy) ; | |
176 | \& $errstring = $gz->gzerror() ; | |
177 | \& $gzerrno | |
178 | .Ve | |
179 | .PP | |
180 | .Vb 2 | |
181 | \& $dest = Compress::Zlib::memGzip($buffer) ; | |
182 | \& $dest = Compress::Zlib::memGunzip($buffer) ; | |
183 | .Ve | |
184 | .PP | |
185 | .Vb 2 | |
186 | \& $crc = adler32($buffer [,$crc]) ; | |
187 | \& $crc = crc32($buffer [,$crc]) ; | |
188 | .Ve | |
189 | .PP | |
190 | .Vb 1 | |
191 | \& ZLIB_VERSION | |
192 | .Ve | |
193 | .SH "DESCRIPTION" | |
194 | .IX Header "DESCRIPTION" | |
195 | The \fICompress::Zlib\fR module provides a Perl interface to the \fIzlib\fR | |
196 | compression library (see \*(L"\s-1AUTHOR\s0\*(R" for details about where to get | |
197 | \&\fIzlib\fR). Most of the functionality provided by \fIzlib\fR is available | |
198 | in \fICompress::Zlib\fR. | |
199 | .PP | |
200 | The module can be split into two general areas of functionality, namely | |
201 | in-memory compression/decompression and read/write access to \fIgzip\fR | |
202 | files. Each of these areas will be discussed separately below. | |
203 | .SH "DEFLATE" | |
204 | .IX Header "DEFLATE" | |
205 | The interface \fICompress::Zlib\fR provides to the in-memory \fIdeflate\fR | |
206 | (and \fIinflate\fR) functions has been modified to fit into a Perl model. | |
207 | .PP | |
208 | The main difference is that for both inflation and deflation, the Perl | |
209 | interface will \fIalways\fR consume the complete input buffer before | |
210 | returning. Also the output buffer returned will be automatically grown | |
211 | to fit the amount of output available. | |
212 | .PP | |
213 | Here is a definition of the interface available: | |
214 | .ie n .Sh "\fB($d, \fP\fB$status\fP\fB) = deflateInit( [\s-1OPT\s0] )\fP" | |
215 | .el .Sh "\fB($d, \fP\f(CB$status\fP\fB) = deflateInit( [\s-1OPT\s0] )\fP" | |
216 | .IX Subsection "($d, $status) = deflateInit( [OPT] )" | |
217 | Initialises a deflation stream. | |
218 | .PP | |
219 | It combines the features of the \fIzlib\fR functions \fBdeflateInit\fR, | |
220 | \&\fBdeflateInit2\fR and \fBdeflateSetDictionary\fR. | |
221 | .PP | |
222 | If successful, it will return the initialised deflation stream, \fB$d\fR | |
223 | and \fB$status\fR of \f(CW\*(C`Z_OK\*(C'\fR in a list context. In scalar context it | |
224 | returns the deflation stream, \fB$d\fR, only. | |
225 | .PP | |
226 | If not successful, the returned deflation stream (\fB$d\fR) will be | |
227 | \&\fIundef\fR and \fB$status\fR will hold the exact \fIzlib\fR error code. | |
228 | .PP | |
229 | The function optionally takes a number of named options specified as | |
230 | \&\f(CW\*(C`\-Name=>value\*(C'\fR pairs. This allows individual options to be | |
231 | tailored without having to specify them all in the parameter list. | |
232 | .PP | |
233 | For backward compatibility, it is also possible to pass the parameters | |
234 | as a reference to a hash containing the name=>value pairs. | |
235 | .PP | |
236 | The function takes one optional parameter, a reference to a hash. The | |
237 | contents of the hash allow the deflation interface to be tailored. | |
238 | .PP | |
239 | Here is a list of the valid options: | |
240 | .IP "\fB\-Level\fR" 5 | |
241 | .IX Item "-Level" | |
242 | Defines the compression level. Valid values are 0 through 9, | |
243 | \&\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 | |
244 | \&\f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR. | |
245 | .Sp | |
246 | The default is \f(CW\*(C`\-Level =>Z_DEFAULT_COMPRESSION\*(C'\fR. | |
247 | .IP "\fB\-Method\fR" 5 | |
248 | .IX Item "-Method" | |
249 | Defines the compression method. The only valid value at present (and | |
250 | the default) is \f(CW\*(C`\-Method =>Z_DEFLATED\*(C'\fR. | |
251 | .IP "\fB\-WindowBits\fR" 5 | |
252 | .IX Item "-WindowBits" | |
253 | For a definition of the meaning and valid values for \fBWindowBits\fR | |
254 | refer to the \fIzlib\fR documentation for \fIdeflateInit2\fR. | |
255 | .Sp | |
256 | Defaults to \f(CW\*(C`\-WindowBits =>MAX_WBITS\*(C'\fR. | |
257 | .IP "\fB\-MemLevel\fR" 5 | |
258 | .IX Item "-MemLevel" | |
259 | For a definition of the meaning and valid values for \fBMemLevel\fR | |
260 | refer to the \fIzlib\fR documentation for \fIdeflateInit2\fR. | |
261 | .Sp | |
262 | Defaults to \f(CW\*(C`\-MemLevel =>MAX_MEM_LEVEL\*(C'\fR. | |
263 | .IP "\fB\-Strategy\fR" 5 | |
264 | .IX Item "-Strategy" | |
265 | Defines the strategy used to tune the compression. The valid values are | |
266 | \&\f(CW\*(C`Z_DEFAULT_STRATEGY\*(C'\fR, \f(CW\*(C`Z_FILTERED\*(C'\fR and \f(CW\*(C`Z_HUFFMAN_ONLY\*(C'\fR. | |
267 | .Sp | |
268 | The default is \f(CW\*(C`\-Strategy =>Z_DEFAULT_STRATEGY\*(C'\fR. | |
269 | .IP "\fB\-Dictionary\fR" 5 | |
270 | .IX Item "-Dictionary" | |
271 | When a dictionary is specified \fICompress::Zlib\fR will automatically | |
272 | call \fBdeflateSetDictionary\fR directly after calling \fBdeflateInit\fR. The | |
273 | Adler32 value for the dictionary can be obtained by calling the method | |
274 | \&\f(CW\*(C`$d\-\*(C'\fR\fIdict_adler()\fR>. | |
275 | .Sp | |
276 | The default is no dictionary. | |
277 | .IP "\fB\-Bufsize\fR" 5 | |
278 | .IX Item "-Bufsize" | |
279 | Sets the initial size for the deflation buffer. If the buffer has to be | |
280 | reallocated to increase the size, it will grow in increments of | |
281 | \&\fBBufsize\fR. | |
282 | .Sp | |
283 | The default is 4096. | |
284 | .PP | |
285 | Here is an example of using the \fBdeflateInit\fR optional parameter list | |
286 | to override the default buffer size and compression level. All other | |
287 | options will take their default values. | |
288 | .PP | |
289 | .Vb 2 | |
290 | \& deflateInit( -Bufsize => 300, | |
291 | \& -Level => Z_BEST_SPEED ) ; | |
292 | .Ve | |
293 | .ie n .Sh "\fB($out, \fP\fB$status\fP\fB) = \fP\f(BI$d\fP\fB\->deflate($buffer)\fP" | |
294 | .el .Sh "\fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$d\fP\fB\->deflate($buffer)\fP" | |
295 | .IX Subsection "($out, $status) = $d->deflate($buffer)" | |
296 | Deflates the contents of \fB$buffer\fR. The buffer can either be a scalar | |
297 | or a scalar reference. When finished, \fB$buffer\fR will be | |
298 | completely processed (assuming there were no errors). If the deflation | |
299 | was successful it returns the deflated output, \fB$out\fR, and a status | |
300 | value, \fB$status\fR, of \f(CW\*(C`Z_OK\*(C'\fR. | |
301 | .PP | |
302 | On error, \fB$out\fR will be \fIundef\fR and \fB$status\fR will contain the | |
303 | \&\fIzlib\fR error code. | |
304 | .PP | |
305 | In a scalar context \fBdeflate\fR will return \fB$out\fR only. | |
306 | .PP | |
307 | As with the \fIdeflate\fR function in \fIzlib\fR, it is not necessarily the | |
308 | case that any output will be produced by this method. So don't rely on | |
309 | the fact that \fB$out\fR is empty for an error test. | |
310 | .ie n .Sh "\fB($out, \fP\fB$status\fP\fB) = \fP\f(BI$d\fP\fB\->flush([flush_type])\fP" | |
311 | .el .Sh "\fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$d\fP\fB\->flush([flush_type])\fP" | |
312 | .IX Subsection "($out, $status) = $d->flush([flush_type])" | |
313 | Typically used to finish the deflation. Any pending output will be | |
314 | returned via \fB$out\fR. | |
315 | \&\fB$status\fR will have a value \f(CW\*(C`Z_OK\*(C'\fR if successful. | |
316 | .PP | |
317 | In a scalar context \fBflush\fR will return \fB$out\fR only. | |
318 | .PP | |
319 | Note that flushing can seriously degrade the compression ratio, so it | |
320 | should only be used to terminate a decompression (using \f(CW\*(C`Z_FINISH\*(C'\fR) or | |
321 | when you want to create a \fIfull flush point\fR (using \f(CW\*(C`Z_FULL_FLUSH\*(C'\fR). | |
322 | .PP | |
323 | By default the \f(CW\*(C`flush_type\*(C'\fR used is \f(CW\*(C`Z_FINISH\*(C'\fR. Other valid values | |
324 | 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 | |
325 | and \f(CW\*(C`Z_FULL_FLUSH\*(C'\fR. It is strongly recommended that you only set the | |
326 | \&\f(CW\*(C`flush_type\*(C'\fR parameter if you fully understand the implications of | |
327 | what it does. See the \f(CW\*(C`zlib\*(C'\fR documentation for details. | |
328 | .ie n .Sh "\fB$status = \fP\fB$d\fP\fB\->deflateParams([\s-1OPT\s0])\fP" | |
329 | .el .Sh "\fB$status = \fP\f(CB$d\fP\fB\->deflateParams([\s-1OPT\s0])\fP" | |
330 | .IX Subsection "$status = $d->deflateParams([OPT])" | |
331 | Change settings for the deflate stream \f(CW$d\fR. | |
332 | .PP | |
333 | The list of the valid options is shown below. Options not specified | |
334 | will remain unchanged. | |
335 | .IP "\fB\-Level\fR" 5 | |
336 | .IX Item "-Level" | |
337 | Defines the compression level. Valid values are 0 through 9, | |
338 | \&\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 | |
339 | \&\f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR. | |
340 | .IP "\fB\-Strategy\fR" 5 | |
341 | .IX Item "-Strategy" | |
342 | Defines the strategy used to tune the compression. The valid values are | |
343 | \&\f(CW\*(C`Z_DEFAULT_STRATEGY\*(C'\fR, \f(CW\*(C`Z_FILTERED\*(C'\fR and \f(CW\*(C`Z_HUFFMAN_ONLY\*(C'\fR. | |
344 | .Sh "\fB$d\->\fP\f(BIdict_adler()\fP\fB\fP" | |
345 | .IX Subsection "$d->dict_adler()" | |
346 | Returns the adler32 value for the dictionary. | |
347 | .Sh "\fB$d\->\fP\f(BImsg()\fP\fB\fP" | |
348 | .IX Subsection "$d->msg()" | |
349 | Returns the last error message generated by zlib. | |
350 | .Sh "\fB$d\->\fP\f(BItotal_in()\fP\fB\fP" | |
351 | .IX Subsection "$d->total_in()" | |
352 | Returns the total number of bytes uncompressed bytes input to deflate. | |
353 | .Sh "\fB$d\->\fP\f(BItotal_out()\fP\fB\fP" | |
354 | .IX Subsection "$d->total_out()" | |
355 | Returns the total number of compressed bytes output from deflate. | |
356 | .Sh "Example" | |
357 | .IX Subsection "Example" | |
358 | Here is a trivial example of using \fBdeflate\fR. It simply reads standard | |
359 | input, deflates it and writes it to standard output. | |
360 | .PP | |
361 | .Vb 2 | |
362 | \& use strict ; | |
363 | \& use warnings ; | |
364 | .Ve | |
365 | .PP | |
366 | .Vb 1 | |
367 | \& use Compress::Zlib ; | |
368 | .Ve | |
369 | .PP | |
370 | .Vb 4 | |
371 | \& binmode STDIN; | |
372 | \& binmode STDOUT; | |
373 | \& my $x = deflateInit() | |
374 | \& or die "Cannot create a deflation stream\en" ; | |
375 | .Ve | |
376 | .PP | |
377 | .Vb 4 | |
378 | \& my ($output, $status) ; | |
379 | \& while (<>) | |
380 | \& { | |
381 | \& ($output, $status) = $x->deflate($_) ; | |
382 | .Ve | |
383 | .PP | |
384 | .Vb 2 | |
385 | \& $status == Z_OK | |
386 | \& or die "deflation failed\en" ; | |
387 | .Ve | |
388 | .PP | |
389 | .Vb 2 | |
390 | \& print $output ; | |
391 | \& } | |
392 | .Ve | |
393 | .PP | |
394 | .Vb 1 | |
395 | \& ($output, $status) = $x->flush() ; | |
396 | .Ve | |
397 | .PP | |
398 | .Vb 2 | |
399 | \& $status == Z_OK | |
400 | \& or die "deflation failed\en" ; | |
401 | .Ve | |
402 | .PP | |
403 | .Vb 1 | |
404 | \& print $output ; | |
405 | .Ve | |
406 | .SH "INFLATE" | |
407 | .IX Header "INFLATE" | |
408 | Here is a definition of the interface: | |
409 | .ie n .Sh "\fB($i, \fP\fB$status\fP\fB) = \fP\f(BIinflateInit()\fP\fB\fP" | |
410 | .el .Sh "\fB($i, \fP\f(CB$status\fP\fB) = \fP\f(BIinflateInit()\fP\fB\fP" | |
411 | .IX Subsection "($i, $status) = inflateInit()" | |
412 | Initialises an inflation stream. | |
413 | .PP | |
414 | In a list context it returns the inflation stream, \fB$i\fR, and the | |
415 | \&\fIzlib\fR status code (\fB$status\fR). In a scalar context it returns the | |
416 | inflation stream only. | |
417 | .PP | |
418 | If successful, \fB$i\fR will hold the inflation stream and \fB$status\fR will | |
419 | be \f(CW\*(C`Z_OK\*(C'\fR. | |
420 | .PP | |
421 | If not successful, \fB$i\fR will be \fIundef\fR and \fB$status\fR will hold the | |
422 | \&\fIzlib\fR error code. | |
423 | .PP | |
424 | The function optionally takes a number of named options specified as | |
425 | \&\f(CW\*(C`\-Name=>value\*(C'\fR pairs. This allows individual options to be | |
426 | tailored without having to specify them all in the parameter list. | |
427 | .PP | |
428 | For backward compatibility, it is also possible to pass the parameters | |
429 | as a reference to a hash containing the name=>value pairs. | |
430 | .PP | |
431 | The function takes one optional parameter, a reference to a hash. The | |
432 | contents of the hash allow the deflation interface to be tailored. | |
433 | .PP | |
434 | Here is a list of the valid options: | |
435 | .IP "\fB\-WindowBits\fR" 5 | |
436 | .IX Item "-WindowBits" | |
437 | For a definition of the meaning and valid values for \fBWindowBits\fR | |
438 | refer to the \fIzlib\fR documentation for \fIinflateInit2\fR. | |
439 | .Sp | |
440 | Defaults to \f(CW\*(C`\-WindowBits =>MAX_WBITS\*(C'\fR. | |
441 | .IP "\fB\-Bufsize\fR" 5 | |
442 | .IX Item "-Bufsize" | |
443 | Sets the initial size for the inflation buffer. If the buffer has to be | |
444 | reallocated to increase the size, it will grow in increments of | |
445 | \&\fBBufsize\fR. | |
446 | .Sp | |
447 | Default is 4096. | |
448 | .IP "\fB\-Dictionary\fR" 5 | |
449 | .IX Item "-Dictionary" | |
450 | The default is no dictionary. | |
451 | .PP | |
452 | Here is an example of using the \fBinflateInit\fR optional parameter to | |
453 | override the default buffer size. | |
454 | .PP | |
455 | .Vb 1 | |
456 | \& inflateInit( -Bufsize => 300 ) ; | |
457 | .Ve | |
458 | .ie n .Sh "\fB($out, \fP\fB$status\fP\fB) = \fP\f(BI$i\fP\fB\->inflate($buffer)\fP" | |
459 | .el .Sh "\fB($out, \fP\f(CB$status\fP\fB) = \fP\f(CB$i\fP\fB\->inflate($buffer)\fP" | |
460 | .IX Subsection "($out, $status) = $i->inflate($buffer)" | |
461 | Inflates the complete contents of \fB$buffer\fR. The buffer can either be | |
462 | a scalar or a scalar reference. | |
463 | .PP | |
464 | Returns \f(CW\*(C`Z_OK\*(C'\fR if successful and \f(CW\*(C`Z_STREAM_END\*(C'\fR if the end of the | |
465 | compressed data has been successfully reached. | |
466 | If not successful, \fB$out\fR will be \fIundef\fR and \fB$status\fR will hold | |
467 | the \fIzlib\fR error code. | |
468 | .PP | |
469 | The \f(CW$buffer\fR parameter is modified by \f(CW\*(C`inflate\*(C'\fR. On completion it | |
470 | will contain what remains of the input buffer after inflation. This | |
471 | means that \f(CW$buffer\fR will be an empty string when the return status is | |
472 | \&\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 | |
473 | parameter will contains what (if anything) was stored in the input | |
474 | buffer after the deflated data stream. | |
475 | .PP | |
476 | This feature is useful when processing a file format that encapsulates | |
477 | a compressed data stream (e.g. gzip, zip). | |
478 | .ie n .Sh "\fB$status = \fP\fB$i\fP\fB\->inflateSync($buffer)\fP" | |
479 | .el .Sh "\fB$status = \fP\f(CB$i\fP\fB\->inflateSync($buffer)\fP" | |
480 | .IX Subsection "$status = $i->inflateSync($buffer)" | |
481 | Scans \f(CW$buffer\fR until it reaches either a \fIfull flush point\fR or the | |
482 | end of the buffer. | |
483 | .PP | |
484 | If a \fIfull flush point\fR is found, \f(CW\*(C`Z_OK\*(C'\fR is returned and \f(CW$buffer\fR | |
485 | will be have all data up to the flush point removed. This can then be | |
486 | passed to the \f(CW\*(C`deflate\*(C'\fR method. | |
487 | .PP | |
488 | Any other return code means that a flush point was not found. If more | |
489 | data is available, \f(CW\*(C`inflateSync\*(C'\fR can be called repeatedly with more | |
490 | compressed data until the flush point is found. | |
491 | .Sh "\fB$i\->\fP\f(BIdict_adler()\fP\fB\fP" | |
492 | .IX Subsection "$i->dict_adler()" | |
493 | Returns the adler32 value for the dictionary. | |
494 | .Sh "\fB$i\->\fP\f(BImsg()\fP\fB\fP" | |
495 | .IX Subsection "$i->msg()" | |
496 | Returns the last error message generated by zlib. | |
497 | .Sh "\fB$i\->\fP\f(BItotal_in()\fP\fB\fP" | |
498 | .IX Subsection "$i->total_in()" | |
499 | Returns the total number of bytes compressed bytes input to inflate. | |
500 | .Sh "\fB$i\->\fP\f(BItotal_out()\fP\fB\fP" | |
501 | .IX Subsection "$i->total_out()" | |
502 | Returns the total number of uncompressed bytes output from inflate. | |
503 | .Sh "Example" | |
504 | .IX Subsection "Example" | |
505 | Here is an example of using \fBinflate\fR. | |
506 | .PP | |
507 | .Vb 2 | |
508 | \& use strict ; | |
509 | \& use warnings ; | |
510 | .Ve | |
511 | .PP | |
512 | .Vb 1 | |
513 | \& use Compress::Zlib ; | |
514 | .Ve | |
515 | .PP | |
516 | .Vb 2 | |
517 | \& my $x = inflateInit() | |
518 | \& or die "Cannot create a inflation stream\en" ; | |
519 | .Ve | |
520 | .PP | |
521 | .Vb 3 | |
522 | \& my $input = '' ; | |
523 | \& binmode STDIN; | |
524 | \& binmode STDOUT; | |
525 | .Ve | |
526 | .PP | |
527 | .Vb 4 | |
528 | \& my ($output, $status) ; | |
529 | \& while (read(STDIN, $input, 4096)) | |
530 | \& { | |
531 | \& ($output, $status) = $x->inflate(\e$input) ; | |
532 | .Ve | |
533 | .PP | |
534 | .Vb 2 | |
535 | \& print $output | |
536 | \& if $status == Z_OK or $status == Z_STREAM_END ; | |
537 | .Ve | |
538 | .PP | |
539 | .Vb 2 | |
540 | \& last if $status != Z_OK ; | |
541 | \& } | |
542 | .Ve | |
543 | .PP | |
544 | .Vb 2 | |
545 | \& die "inflation failed\en" | |
546 | \& unless $status == Z_STREAM_END ; | |
547 | .Ve | |
548 | .SH "COMPRESS/UNCOMPRESS" | |
549 | .IX Header "COMPRESS/UNCOMPRESS" | |
550 | Two high-level functions are provided by \fIzlib\fR to perform in-memory | |
551 | compression. They are \fBcompress\fR and \fBuncompress\fR. Two Perl subs are | |
552 | provided which provide similar functionality. | |
553 | .ie n .IP "\fB$dest = compress($source [, \fB$level\fB] ) ;\fR" 5 | |
554 | .el .IP "\fB$dest = compress($source [, \f(CB$level\fB] ) ;\fR" 5 | |
555 | .IX Item "$dest = compress($source [, $level] ) ;" | |
556 | Compresses \fB$source\fR. If successful it returns the | |
557 | compressed data. Otherwise it returns \fIundef\fR. | |
558 | .Sp | |
559 | The source buffer can either be a scalar or a scalar reference. | |
560 | .Sp | |
561 | The \fB$level\fR paramter defines the compression level. Valid values are | |
562 | 0 through 9, \f(CW\*(C`Z_NO_COMPRESSION\*(C'\fR, \f(CW\*(C`Z_BEST_SPEED\*(C'\fR, | |
563 | \&\f(CW\*(C`Z_BEST_COMPRESSION\*(C'\fR, and \f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR. | |
564 | If \fB$level\fR is not specified \f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR will be used. | |
565 | .IP "\fB$dest = uncompress($source) ;\fR" 5 | |
566 | .IX Item "$dest = uncompress($source) ;" | |
567 | Uncompresses \fB$source\fR. If successful it returns the uncompressed | |
568 | data. Otherwise it returns \fIundef\fR. | |
569 | .Sp | |
570 | The source buffer can either be a scalar or a scalar reference. | |
571 | .SH "GZIP INTERFACE" | |
572 | .IX Header "GZIP INTERFACE" | |
573 | A number of functions are supplied in \fIzlib\fR for reading and writing | |
574 | \&\fIgzip\fR files. This module provides an interface to most of them. In | |
575 | general the interface provided by this module operates identically to | |
576 | the functions provided by \fIzlib\fR. Any differences are explained | |
577 | below. | |
578 | .IP "\fB$gz = gzopen(filename or filehandle, mode)\fR" 5 | |
579 | .IX Item "$gz = gzopen(filename or filehandle, mode)" | |
580 | This function operates identically to the \fIzlib\fR equivalent except | |
581 | that it returns an object which is used to access the other \fIgzip\fR | |
582 | methods. | |
583 | .Sp | |
584 | As with the \fIzlib\fR equivalent, the \fBmode\fR parameter is used to | |
585 | specify both whether the file is opened for reading or writing and to | |
586 | optionally specify a a compression level. Refer to the \fIzlib\fR | |
587 | documentation for the exact format of the \fBmode\fR parameter. | |
588 | .Sp | |
589 | If a reference to an open filehandle is passed in place of the | |
590 | filename, gzdopen will be called behind the scenes. The third example | |
591 | at the end of this section, \fIgzstream\fR, uses this feature. | |
592 | .ie n .IP "\fB$bytesread = \fB$gz\fB\->gzread($buffer [, \f(BI$size\fB]) ;\fR" 5 | |
593 | .el .IP "\fB$bytesread = \f(CB$gz\fB\->gzread($buffer [, \f(CB$size\fB]) ;\fR" 5 | |
594 | .IX Item "$bytesread = $gz->gzread($buffer [, $size]) ;" | |
595 | Reads \fB$size\fR bytes from the compressed file into \fB$buffer\fR. If | |
596 | \&\fB$size\fR is not specified, it will default to 4096. If the scalar | |
597 | \&\fB$buffer\fR is not large enough, it will be extended automatically. | |
598 | .Sp | |
599 | Returns the number of bytes actually read. On \s-1EOF\s0 it returns 0 and in | |
600 | the case of an error, \-1. | |
601 | .ie n .IP "\fB$bytesread = \fB$gz\fB\->gzreadline($line) ;\fR" 5 | |
602 | .el .IP "\fB$bytesread = \f(CB$gz\fB\->gzreadline($line) ;\fR" 5 | |
603 | .IX Item "$bytesread = $gz->gzreadline($line) ;" | |
604 | Reads the next line from the compressed file into \fB$line\fR. | |
605 | .Sp | |
606 | Returns the number of bytes actually read. On \s-1EOF\s0 it returns 0 and in | |
607 | the case of an error, \-1. | |
608 | .Sp | |
609 | It is legal to intermix calls to \fBgzread\fR and \fBgzreadline\fR. | |
610 | .Sp | |
611 | At this time \fBgzreadline\fR ignores the variable \f(CW$/\fR | |
612 | (\f(CW$INPUT_RECORD_SEPARATOR\fR or \f(CW$RS\fR when \f(CW\*(C`English\*(C'\fR is in use). The | |
613 | end of a line is denoted by the C character \f(CW'\en'\fR. | |
614 | .ie n .IP "\fB$byteswritten = \fB$gz\fB\->gzwrite($buffer) ;\fR" 5 | |
615 | .el .IP "\fB$byteswritten = \f(CB$gz\fB\->gzwrite($buffer) ;\fR" 5 | |
616 | .IX Item "$byteswritten = $gz->gzwrite($buffer) ;" | |
617 | Writes the contents of \fB$buffer\fR to the compressed file. Returns the | |
618 | number of bytes actually written, or 0 on error. | |
619 | .ie n .IP "\fB$status = \fB$gz\fB\->gzflush($flush) ;\fR" 5 | |
620 | .el .IP "\fB$status = \f(CB$gz\fB\->gzflush($flush) ;\fR" 5 | |
621 | .IX Item "$status = $gz->gzflush($flush) ;" | |
622 | Flushes all pending output to the compressed file. | |
623 | Works identically to the \fIzlib\fR function it interfaces to. Note that | |
624 | the use of \fBgzflush\fR can degrade compression. | |
625 | .Sp | |
626 | Returns \f(CW\*(C`Z_OK\*(C'\fR if \fB$flush\fR is \f(CW\*(C`Z_FINISH\*(C'\fR and all output could be | |
627 | flushed. Otherwise the zlib error code is returned. | |
628 | .Sp | |
629 | Refer to the \fIzlib\fR documentation for the valid values of \fB$flush\fR. | |
630 | .ie n .IP "\fB$status = \fB$gz\fB\->\f(BIgzeof()\fB ;\fR" 5 | |
631 | .el .IP "\fB$status = \f(CB$gz\fB\->\f(BIgzeof()\fB ;\fR" 5 | |
632 | .IX Item "$status = $gz->gzeof() ;" | |
633 | Returns 1 if the end of file has been detected while reading the input | |
634 | file, otherwise returns 0. | |
635 | .IP "\fB$gz\->gzclose\fR" 5 | |
636 | .IX Item "$gz->gzclose" | |
637 | Closes the compressed file. Any pending data is flushed to the file | |
638 | before it is closed. | |
639 | .ie n .IP "\fB$gz\->gzsetparams($level, \fB$strategy\fB\fR" 5 | |
640 | .el .IP "\fB$gz\->gzsetparams($level, \f(CB$strategy\fB\fR" 5 | |
641 | .IX Item "$gz->gzsetparams($level, $strategy" | |
642 | Change settings for the deflate stream \f(CW$gz\fR. | |
643 | .Sp | |
644 | The list of the valid options is shown below. Options not specified | |
645 | will remain unchanged. | |
646 | .Sp | |
647 | Note: This method is only available if you are running zlib 1.0.6 or better. | |
648 | .RS 5 | |
649 | .IP "\fB$level\fR" 5 | |
650 | .IX Item "$level" | |
651 | Defines the compression level. Valid values are 0 through 9, | |
652 | \&\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 | |
653 | \&\f(CW\*(C`Z_DEFAULT_COMPRESSION\*(C'\fR. | |
654 | .IP "\fB$strategy\fR" 5 | |
655 | .IX Item "$strategy" | |
656 | Defines the strategy used to tune the compression. The valid values are | |
657 | \&\f(CW\*(C`Z_DEFAULT_STRATEGY\*(C'\fR, \f(CW\*(C`Z_FILTERED\*(C'\fR and \f(CW\*(C`Z_HUFFMAN_ONLY\*(C'\fR. | |
658 | .RE | |
659 | .RS 5 | |
660 | .RE | |
661 | .IP "\fB$gz\->gzerror\fR" 5 | |
662 | .IX Item "$gz->gzerror" | |
663 | Returns the \fIzlib\fR error message or number for the last operation | |
664 | associated with \fB$gz\fR. The return value will be the \fIzlib\fR error | |
665 | number when used in a numeric context and the \fIzlib\fR error message | |
666 | when used in a string context. The \fIzlib\fR error number constants, | |
667 | shown below, are available for use. | |
668 | .Sp | |
669 | .Vb 7 | |
670 | \& Z_OK | |
671 | \& Z_STREAM_END | |
672 | \& Z_ERRNO | |
673 | \& Z_STREAM_ERROR | |
674 | \& Z_DATA_ERROR | |
675 | \& Z_MEM_ERROR | |
676 | \& Z_BUF_ERROR | |
677 | .Ve | |
678 | .IP "\fB$gzerrno\fR" 5 | |
679 | .IX Item "$gzerrno" | |
680 | The \fB$gzerrno\fR scalar holds the error code associated with the most | |
681 | recent \fIgzip\fR routine. Note that unlike \fB\f(BIgzerror()\fB\fR, the error is | |
682 | \&\fInot\fR associated with a particular file. | |
683 | .Sp | |
684 | As with \fB\f(BIgzerror()\fB\fR it returns an error number in numeric context and | |
685 | an error message in string context. Unlike \fB\f(BIgzerror()\fB\fR though, the | |
686 | error message will correspond to the \fIzlib\fR message when the error is | |
687 | associated with \fIzlib\fR itself, or the \s-1UNIX\s0 error message when it is | |
688 | not (i.e. \fIzlib\fR returned \f(CW\*(C`Z_ERRORNO\*(C'\fR). | |
689 | .Sp | |
690 | As there is an overlap between the error numbers used by \fIzlib\fR and | |
691 | \&\s-1UNIX\s0, \fB$gzerrno\fR should only be used to check for the presence of | |
692 | \&\fIan\fR error in numeric context. Use \fB\f(BIgzerror()\fB\fR to check for specific | |
693 | \&\fIzlib\fR errors. The \fIgzcat\fR example below shows how the variable can | |
694 | be used safely. | |
695 | .Sh "Examples" | |
696 | .IX Subsection "Examples" | |
697 | Here is an example script which uses the interface. It implements a | |
698 | \&\fIgzcat\fR function. | |
699 | .PP | |
700 | .Vb 2 | |
701 | \& use strict ; | |
702 | \& use warnings ; | |
703 | .Ve | |
704 | .PP | |
705 | .Vb 1 | |
706 | \& use Compress::Zlib ; | |
707 | .Ve | |
708 | .PP | |
709 | .Vb 2 | |
710 | \& die "Usage: gzcat file...\en" | |
711 | \& unless @ARGV ; | |
712 | .Ve | |
713 | .PP | |
714 | .Vb 1 | |
715 | \& my $file ; | |
716 | .Ve | |
717 | .PP | |
718 | .Vb 2 | |
719 | \& foreach $file (@ARGV) { | |
720 | \& my $buffer ; | |
721 | .Ve | |
722 | .PP | |
723 | .Vb 2 | |
724 | \& my $gz = gzopen($file, "rb") | |
725 | \& or die "Cannot open $file: $gzerrno\en" ; | |
726 | .Ve | |
727 | .PP | |
728 | .Vb 1 | |
729 | \& print $buffer while $gz->gzread($buffer) > 0 ; | |
730 | .Ve | |
731 | .PP | |
732 | .Vb 2 | |
733 | \& die "Error reading from $file: $gzerrno" . ($gzerrno+0) . "\en" | |
734 | \& if $gzerrno != Z_STREAM_END ; | |
735 | .Ve | |
736 | .PP | |
737 | .Vb 2 | |
738 | \& $gz->gzclose() ; | |
739 | \& } | |
740 | .Ve | |
741 | .PP | |
742 | Below is a script which makes use of \fBgzreadline\fR. It implements a | |
743 | very simple \fIgrep\fR like script. | |
744 | .PP | |
745 | .Vb 2 | |
746 | \& use strict ; | |
747 | \& use warnings ; | |
748 | .Ve | |
749 | .PP | |
750 | .Vb 1 | |
751 | \& use Compress::Zlib ; | |
752 | .Ve | |
753 | .PP | |
754 | .Vb 2 | |
755 | \& die "Usage: gzgrep pattern file...\en" | |
756 | \& unless @ARGV >= 2; | |
757 | .Ve | |
758 | .PP | |
759 | .Vb 1 | |
760 | \& my $pattern = shift ; | |
761 | .Ve | |
762 | .PP | |
763 | .Vb 1 | |
764 | \& my $file ; | |
765 | .Ve | |
766 | .PP | |
767 | .Vb 3 | |
768 | \& foreach $file (@ARGV) { | |
769 | \& my $gz = gzopen($file, "rb") | |
770 | \& or die "Cannot open $file: $gzerrno\en" ; | |
771 | .Ve | |
772 | .PP | |
773 | .Vb 3 | |
774 | \& while ($gz->gzreadline($_) > 0) { | |
775 | \& print if /$pattern/ ; | |
776 | \& } | |
777 | .Ve | |
778 | .PP | |
779 | .Vb 2 | |
780 | \& die "Error reading from $file: $gzerrno\en" | |
781 | \& if $gzerrno != Z_STREAM_END ; | |
782 | .Ve | |
783 | .PP | |
784 | .Vb 2 | |
785 | \& $gz->gzclose() ; | |
786 | \& } | |
787 | .Ve | |
788 | .PP | |
789 | This script, \fIgzstream\fR, does the opposite of the \fIgzcat\fR script | |
790 | above. It reads from standard input and writes a gzip file to standard | |
791 | output. | |
792 | .PP | |
793 | .Vb 2 | |
794 | \& use strict ; | |
795 | \& use warnings ; | |
796 | .Ve | |
797 | .PP | |
798 | .Vb 1 | |
799 | \& use Compress::Zlib ; | |
800 | .Ve | |
801 | .PP | |
802 | .Vb 1 | |
803 | \& binmode STDOUT; # gzopen only sets it on the fd | |
804 | .Ve | |
805 | .PP | |
806 | .Vb 2 | |
807 | \& my $gz = gzopen(\e*STDOUT, "wb") | |
808 | \& or die "Cannot open stdout: $gzerrno\en" ; | |
809 | .Ve | |
810 | .PP | |
811 | .Vb 4 | |
812 | \& while (<>) { | |
813 | \& $gz->gzwrite($_) | |
814 | \& or die "error writing: $gzerrno\en" ; | |
815 | \& } | |
816 | .Ve | |
817 | .PP | |
818 | .Vb 1 | |
819 | \& $gz->gzclose ; | |
820 | .Ve | |
821 | .Sh "Compress::Zlib::memGzip" | |
822 | .IX Subsection "Compress::Zlib::memGzip" | |
823 | This function is used to create an in-memory gzip file. | |
824 | It creates a minimal gzip header. | |
825 | .PP | |
826 | .Vb 1 | |
827 | \& $dest = Compress::Zlib::memGzip($buffer) ; | |
828 | .Ve | |
829 | .PP | |
830 | If successful, it returns the in-memory gzip file, otherwise it returns | |
831 | undef. | |
832 | .PP | |
833 | The buffer parameter can either be a scalar or a scalar reference. | |
834 | .Sh "Compress::Zlib::memGunzip" | |
835 | .IX Subsection "Compress::Zlib::memGunzip" | |
836 | This function is used to uncompress an in-memory gzip file. | |
837 | .PP | |
838 | .Vb 1 | |
839 | \& $dest = Compress::Zlib::memGunzip($buffer) ; | |
840 | .Ve | |
841 | .PP | |
842 | If successful, it returns the uncompressed gzip file, otherwise it | |
843 | returns undef. | |
844 | .PP | |
845 | The buffer parameter can either be a scalar or a scalar reference. The | |
846 | contents of the buffer parameter are destroyed after calling this | |
847 | function. | |
848 | .SH "CHECKSUM FUNCTIONS" | |
849 | .IX Header "CHECKSUM FUNCTIONS" | |
850 | Two functions are provided by \fIzlib\fR to calculate a checksum. For the | |
851 | Perl interface, the order of the two parameters in both functions has | |
852 | been reversed. This allows both running checksums and one off | |
853 | calculations to be done. | |
854 | .PP | |
855 | .Vb 2 | |
856 | \& $crc = adler32($buffer [,$crc]) ; | |
857 | \& $crc = crc32($buffer [,$crc]) ; | |
858 | .Ve | |
859 | .PP | |
860 | The buffer parameters can either be a scalar or a scalar reference. | |
861 | .PP | |
862 | If the \f(CW$crc\fR parameters is \f(CW\*(C`undef\*(C'\fR, the crc value will be reset. | |
863 | .SH "ACCESSING ZIP FILES" | |
864 | .IX Header "ACCESSING ZIP FILES" | |
865 | Although it is possible to use this module to access .zip files, there | |
866 | is a module on \s-1CPAN\s0 that will do all the hard work for you. Check out | |
867 | .PP | |
868 | .Vb 1 | |
869 | \& http://www.cpan.org/modules/by-module/Archive/Archive-Zip-*.tar.gz | |
870 | .Ve | |
871 | .PP | |
872 | Assuming you don't want to use this module to access zip files there | |
873 | are a number of undocumented features in the zlib library you need to | |
874 | be aware of. | |
875 | .IP "1." 5 | |
876 | When calling \fBinflateInit\fR or \fBdeflateInit\fR the \fBWindowBits\fR parameter | |
877 | must be set to \f(CW\*(C`\-MAX_WBITS\*(C'\fR. This disables the creation of the zlib | |
878 | header. | |
879 | .IP "2." 5 | |
880 | The zlib function \fBinflate\fR, and so the \fBinflate\fR method supplied in | |
881 | this module, assume that there is at least one trailing byte after the | |
882 | compressed data stream. Normally this isn't a problem because both | |
883 | the gzip and zip file formats will guarantee that there is data directly | |
884 | after the compressed data stream. | |
885 | .SH "CONSTANTS" | |
886 | .IX Header "CONSTANTS" | |
887 | All the \fIzlib\fR constants are automatically imported when you make use | |
888 | of \fICompress::Zlib\fR. | |
889 | .SH "AUTHOR" | |
890 | .IX Header "AUTHOR" | |
891 | The \fICompress::Zlib\fR module was written by Paul Marquess, | |
892 | \&\fIpmqs@cpan.org\fR. The latest copy of the module can be | |
893 | found on \s-1CPAN\s0 in \fImodules/by\-module/Compress/Compress\-Zlib\-x.x.tar.gz\fR. | |
894 | .PP | |
895 | The primary site for the \fIzlib\fR compression library is | |
896 | \&\fIhttp://www.zlib.org\fR. | |
897 | .SH "MODIFICATION HISTORY" | |
898 | .IX Header "MODIFICATION HISTORY" | |
899 | See the Changes file. |