1Compress::Raw::Zlib(3)User Contributed Perl DocumentationCompress::Raw::Zlib(3)
2
3
4

NAME

6       Compress::Raw::Zlib - Low-Level Interface to zlib compression library
7

SYNOPSIS

9           use Compress::Raw::Zlib ;
10
11           ($d, $status) = new Compress::Raw::Zlib::Deflate( [OPT] ) ;
12           $status = $d->deflate($input, $output) ;
13           $status = $d->flush($output [, $flush_type]) ;
14           $d->deflateReset() ;
15           $d->deflateParams(OPTS) ;
16           $d->deflateTune(OPTS) ;
17           $d->dict_adler() ;
18           $d->crc32() ;
19           $d->adler32() ;
20           $d->total_in() ;
21           $d->total_out() ;
22           $d->msg() ;
23           $d->get_Strategy();
24           $d->get_Level();
25           $d->get_BufSize();
26
27           ($i, $status) = new Compress::Raw::Zlib::Inflate( [OPT] ) ;
28           $status = $i->inflate($input, $output [, $eof]) ;
29           $status = $i->inflateSync($input) ;
30           $i->dict_adler() ;
31           $d->crc32() ;
32           $d->adler32() ;
33           $i->total_in() ;
34           $i->total_out() ;
35           $i->msg() ;
36           $d->get_BufSize();
37
38           $crc = adler32($buffer [,$crc]) ;
39           $crc = crc32($buffer [,$crc]) ;
40
41           $crc = adler32_combine($crc1, $crc2, $len2)l
42           $crc = crc32_combine($adler1, $adler2, $len2)
43
44           my $version = Compress::Raw::Zlib::zlib_version();
45

DESCRIPTION

47       The Compress::Raw::Zlib module provides a Perl interface to the zlib
48       compression library (see "AUTHOR" for details about where to get zlib).
49

Compress::Raw::Zlib::Deflate

51       This section defines an interface that allows in-memory compression
52       using the deflate interface provided by zlib.
53
54       Here is a definition of the interface available:
55
56   ($d, $status) = new Compress::Raw::Zlib::Deflate( [OPT] )
57       Initialises a deflation object.
58
59       If you are familiar with the zlib library, it combines the features of
60       the zlib functions "deflateInit", "deflateInit2" and
61       "deflateSetDictionary".
62
63       If successful, it will return the initialised deflation object, $d and
64       a $status of "Z_OK" in a list context. In scalar context it returns the
65       deflation object, $d, only.
66
67       If not successful, the returned deflation object, $d, will be undef and
68       $status will hold the a zlib error code.
69
70       The function optionally takes a number of named options specified as
71       "Name => value" pairs. This allows individual options to be tailored
72       without having to specify them all in the parameter list.
73
74       For backward compatibility, it is also possible to pass the parameters
75       as a reference to a hash containing the name=>value pairs.
76
77       Below is a list of the valid options:
78
79       -Level
80            Defines the compression level. Valid values are 0 through 9,
81            "Z_NO_COMPRESSION", "Z_BEST_SPEED", "Z_BEST_COMPRESSION", and
82            "Z_DEFAULT_COMPRESSION".
83
84            The default is "Z_DEFAULT_COMPRESSION".
85
86       -Method
87            Defines the compression method. The only valid value at present
88            (and the default) is "Z_DEFLATED".
89
90       -WindowBits
91            To compress an RFC 1950 data stream, set "WindowBits" to a
92            positive number between 8 and 15.
93
94            To compress an RFC 1951 data stream, set "WindowBits" to
95            "-MAX_WBITS".
96
97            To compress an RFC 1952 data stream (i.e. gzip), set "WindowBits"
98            to "WANT_GZIP".
99
100            For a definition of the meaning and valid values for "WindowBits"
101            refer to the zlib documentation for deflateInit2.
102
103            Defaults to "MAX_WBITS".
104
105       -MemLevel
106            For a definition of the meaning and valid values for "MemLevel"
107            refer to the zlib documentation for deflateInit2.
108
109            Defaults to MAX_MEM_LEVEL.
110
111       -Strategy
112            Defines the strategy used to tune the compression. The valid
113            values are "Z_DEFAULT_STRATEGY", "Z_FILTERED", "Z_RLE", "Z_FIXED"
114            and "Z_HUFFMAN_ONLY".
115
116            The default is "Z_DEFAULT_STRATEGY".
117
118       -Dictionary
119            When a dictionary is specified Compress::Raw::Zlib will
120            automatically call "deflateSetDictionary" directly after calling
121            "deflateInit". The Adler32 value for the dictionary can be
122            obtained by calling the method "$d->dict_adler()".
123
124            The default is no dictionary.
125
126       -Bufsize
127            Sets the initial size for the output buffer used by the
128            "$d->deflate" and "$d->flush" methods. If the buffer has to be
129            reallocated to increase the size, it will grow in increments of
130            "Bufsize".
131
132            The default buffer size is 4096.
133
134       -AppendOutput
135            This option controls how data is written to the output buffer by
136            the "$d->deflate" and "$d->flush" methods.
137
138            If the "AppendOutput" option is set to false, the output buffers
139            in the "$d->deflate" and "$d->flush"  methods will be truncated
140            before uncompressed data is written to them.
141
142            If the option is set to true, uncompressed data will be appended
143            to the output buffer in the "$d->deflate" and "$d->flush" methods.
144
145            This option defaults to false.
146
147       -CRC32
148            If set to true, a crc32 checksum of the uncompressed data will be
149            calculated. Use the "$d->crc32" method to retrieve this value.
150
151            This option defaults to false.
152
153       -ADLER32
154            If set to true, an adler32 checksum of the uncompressed data will
155            be calculated. Use the "$d->adler32" method to retrieve this
156            value.
157
158            This option defaults to false.
159
160       Here is an example of using the "Compress::Raw::Zlib::Deflate" optional
161       parameter list to override the default buffer size and compression
162       level. All other options will take their default values.
163
164           my $d = new Compress::Raw::Zlib::Deflate ( -Bufsize => 300,
165                                                      -Level   => Z_BEST_SPEED ) ;
166
167   $status = $d->deflate($input, $output)
168       Deflates the contents of $input and writes the compressed data to
169       $output.
170
171       The $input and $output parameters can be either scalars or scalar
172       references.
173
174       When finished, $input will be completely processed (assuming there were
175       no errors). If the deflation was successful it writes the deflated data
176       to $output and returns a status value of "Z_OK".
177
178       On error, it returns a zlib error code.
179
180       If the "AppendOutput" option is set to true in the constructor for the
181       $d object, the compressed data will be appended to $output. If it is
182       false, $output will be truncated before any compressed data is written
183       to it.
184
185       Note: This method will not necessarily write compressed data to $output
186       every time it is called. So do not assume that there has been an error
187       if the contents of $output is empty on returning from this method. As
188       long as the return code from the method is "Z_OK", the deflate has
189       succeeded.
190
191   $status = $d->flush($output [, $flush_type])
192       Typically used to finish the deflation. Any pending output will be
193       written to $output.
194
195       Returns "Z_OK" if successful.
196
197       Note that flushing can seriously degrade the compression ratio, so it
198       should only be used to terminate a decompression (using "Z_FINISH") or
199       when you want to create a full flush point (using "Z_FULL_FLUSH").
200
201       By default the "flush_type" used is "Z_FINISH". Other valid values for
202       "flush_type" are "Z_NO_FLUSH", "Z_PARTIAL_FLUSH", "Z_SYNC_FLUSH" and
203       "Z_FULL_FLUSH". It is strongly recommended that you only set the
204       "flush_type" parameter if you fully understand the implications of what
205       it does. See the "zlib" documentation for details.
206
207       If the "AppendOutput" option is set to true in the constructor for the
208       $d object, the compressed data will be appended to $output. If it is
209       false, $output will be truncated before any compressed data is written
210       to it.
211
212   $status = $d->deflateReset()
213       This method will reset the deflation object $d. It can be used when you
214       are compressing multiple data streams and want to use the same object
215       to compress each of them. It should only be used once the previous data
216       stream has been flushed successfully, i.e. a call to
217       "$d->flush(Z_FINISH)" has returned "Z_OK".
218
219       Returns "Z_OK" if successful.
220
221   $status = $d->deflateParams([OPT])
222       Change settings for the deflate object $d.
223
224       The list of the valid options is shown below. Options not specified
225       will remain unchanged.
226
227       -Level
228            Defines the compression level. Valid values are 0 through 9,
229            "Z_NO_COMPRESSION", "Z_BEST_SPEED", "Z_BEST_COMPRESSION", and
230            "Z_DEFAULT_COMPRESSION".
231
232       -Strategy
233            Defines the strategy used to tune the compression. The valid
234            values are "Z_DEFAULT_STRATEGY", "Z_FILTERED" and
235            "Z_HUFFMAN_ONLY".
236
237       -BufSize
238            Sets the initial size for the output buffer used by the
239            "$d->deflate" and "$d->flush" methods. If the buffer has to be
240            reallocated to increase the size, it will grow in increments of
241            "Bufsize".
242
243   $status = $d->deflateTune($good_length, $max_lazy, $nice_length,
244       $max_chain)
245       Tune the internal settings for the deflate object $d. This option is
246       only available if you are running zlib 1.2.2.3 or better.
247
248       Refer to the documentation in zlib.h for instructions on how to fly
249       "deflateTune".
250
251   $d->dict_adler()
252       Returns the adler32 value for the dictionary.
253
254   $d->crc32()
255       Returns the crc32 value for the uncompressed data to date.
256
257       If the "CRC32" option is not enabled in the constructor for this
258       object, this method will always return 0;
259
260   $d->adler32()
261       Returns the adler32 value for the uncompressed data to date.
262
263   $d->msg()
264       Returns the last error message generated by zlib.
265
266   $d->total_in()
267       Returns the total number of bytes uncompressed bytes input to deflate.
268
269   $d->total_out()
270       Returns the total number of compressed bytes output from deflate.
271
272   $d->get_Strategy()
273       Returns the deflation strategy currently used. Valid values are
274       "Z_DEFAULT_STRATEGY", "Z_FILTERED" and "Z_HUFFMAN_ONLY".
275
276   $d->get_Level()
277       Returns the compression level being used.
278
279   $d->get_BufSize()
280       Returns the buffer size used to carry out the compression.
281
282   Example
283       Here is a trivial example of using "deflate". It simply reads standard
284       input, deflates it and writes it to standard output.
285
286           use strict ;
287           use warnings ;
288
289           use Compress::Raw::Zlib ;
290
291           binmode STDIN;
292           binmode STDOUT;
293           my $x = new Compress::Raw::Zlib::Deflate
294              or die "Cannot create a deflation stream\n" ;
295
296           my ($output, $status) ;
297           while (<>)
298           {
299               $status = $x->deflate($_, $output) ;
300
301               $status == Z_OK
302                   or die "deflation failed\n" ;
303
304               print $output ;
305           }
306
307           $status = $x->flush($output) ;
308
309           $status == Z_OK
310               or die "deflation failed\n" ;
311
312           print $output ;
313

Compress::Raw::Zlib::Inflate

315       This section defines an interface that allows in-memory uncompression
316       using the inflate interface provided by zlib.
317
318       Here is a definition of the interface:
319
320    ($i, $status) = new Compress::Raw::Zlib::Inflate( [OPT] )
321       Initialises an inflation object.
322
323       In a list context it returns the inflation object, $i, and the zlib
324       status code ($status). In a scalar context it returns the inflation
325       object only.
326
327       If successful, $i will hold the inflation object and $status will be
328       "Z_OK".
329
330       If not successful, $i will be undef and $status will hold the zlib
331       error code.
332
333       The function optionally takes a number of named options specified as
334       "-Name => value" pairs. This allows individual options to be tailored
335       without having to specify them all in the parameter list.
336
337       For backward compatibility, it is also possible to pass the parameters
338       as a reference to a hash containing the "name=>value" pairs.
339
340       Here is a list of the valid options:
341
342       -WindowBits
343            To uncompress an RFC 1950 data stream, set "WindowBits" to a
344            positive number between 8 and 15.
345
346            To uncompress an RFC 1951 data stream, set "WindowBits" to
347            "-MAX_WBITS".
348
349            To uncompress an RFC 1952 data stream (i.e. gzip), set
350            "WindowBits" to "WANT_GZIP".
351
352            To auto-detect and uncompress an RFC 1950 or RFC 1952 data stream
353            (i.e.  gzip), set "WindowBits" to "WANT_GZIP_OR_ZLIB".
354
355            For a full definition of the meaning and valid values for
356            "WindowBits" refer to the zlib documentation for inflateInit2.
357
358            Defaults to "MAX_WBITS".
359
360       -Bufsize
361            Sets the initial size for the output buffer used by the
362            "$i->inflate" method. If the output buffer in this method has to
363            be reallocated to increase the size, it will grow in increments of
364            "Bufsize".
365
366            Default is 4096.
367
368       -Dictionary
369            The default is no dictionary.
370
371       -AppendOutput
372            This option controls how data is written to the output buffer by
373            the "$i->inflate" method.
374
375            If the option is set to false, the output buffer in the
376            "$i->inflate" method will be truncated before uncompressed data is
377            written to it.
378
379            If the option is set to true, uncompressed data will be appended
380            to the output buffer by the "$i->inflate" method.
381
382            This option defaults to false.
383
384       -CRC32
385            If set to true, a crc32 checksum of the uncompressed data will be
386            calculated. Use the "$i->crc32" method to retrieve this value.
387
388            This option defaults to false.
389
390       -ADLER32
391            If set to true, an adler32 checksum of the uncompressed data will
392            be calculated. Use the "$i->adler32" method to retrieve this
393            value.
394
395            This option defaults to false.
396
397       -ConsumeInput
398            If set to true, this option will remove compressed data from the
399            input buffer of the "$i->inflate" method as the inflate
400            progresses.
401
402            This option can be useful when you are processing compressed data
403            that is embedded in another file/buffer. In this case the data
404            that immediately follows the compressed stream will be left in the
405            input buffer.
406
407            This option defaults to true.
408
409       -LimitOutput
410            The "LimitOutput" option changes the behavior of the "$i->inflate"
411            method so that the amount of memory used by the output buffer can
412            be limited.
413
414            When "LimitOutput" is used the size of the output buffer used will
415            either be the value of the "Bufsize" option or the amount of
416            memory already allocated to $output, whichever is larger.
417            Predicting the output size available is tricky, so don't rely on
418            getting an exact output buffer size.
419
420            When "LimitOutout" is not specified "$i->inflate" will use as much
421            memory as it takes to write all the uncompressed data it creates
422            by uncompressing the input buffer.
423
424            If "LimitOutput" is enabled, the "ConsumeInput" option will also
425            be enabled.
426
427            This option defaults to false.
428
429            See "The LimitOutput option" for a discussion on why "LimitOutput"
430            is needed and how to use it.
431
432       Here is an example of using an optional parameter to override the
433       default buffer size.
434
435           my ($i, $status) = new Compress::Raw::Zlib::Inflate( -Bufsize => 300 ) ;
436
437    $status = $i->inflate($input, $output [,$eof])
438       Inflates the complete contents of $input and writes the uncompressed
439       data to $output. The $input and $output parameters can either be
440       scalars or scalar references.
441
442       Returns "Z_OK" if successful and "Z_STREAM_END" if the end of the
443       compressed data has been successfully reached.
444
445       If not successful $status will hold the zlib error code.
446
447       If the "ConsumeInput" option has been set to true when the
448       "Compress::Raw::Zlib::Inflate" object is created, the $input parameter
449       is modified by "inflate". On completion it will contain what remains of
450       the input buffer after inflation. In practice, this means that when the
451       return status is "Z_OK" the $input parameter will contain an empty
452       string, and when the return status is "Z_STREAM_END" the $input
453       parameter will contains what (if anything) was stored in the input
454       buffer after the deflated data stream.
455
456       This feature is useful when processing a file format that encapsulates
457       a compressed data stream (e.g. gzip, zip) and there is useful data
458       immediately after the deflation stream.
459
460       If the "AppendOutput" option is set to true in the constructor for this
461       object, the uncompressed data will be appended to $output. If it is
462       false, $output will be truncated before any uncompressed data is
463       written to it.
464
465       The $eof parameter needs a bit of explanation.
466
467       Prior to version 1.2.0, zlib assumed that there was at least one
468       trailing byte immediately after the compressed data stream when it was
469       carrying out decompression. This normally isn't a problem because the
470       majority of zlib applications guarantee that there will be data
471       directly after the compressed data stream.  For example, both gzip (RFC
472       1950) and zip both define trailing data that follows the compressed
473       data stream.
474
475       The $eof parameter only needs to be used if all of the following
476       conditions apply
477
478       1.   You are either using a copy of zlib that is older than version
479            1.2.0 or you want your application code to be able to run with as
480            many different versions of zlib as possible.
481
482       2.   You have set the "WindowBits" parameter to "-MAX_WBITS" in the
483            constructor for this object, i.e. you are uncompressing a raw
484            deflated data stream (RFC 1951).
485
486       3.   There is no data immediately after the compressed data stream.
487
488       If all of these are the case, then you need to set the $eof parameter
489       to true on the final call (and only the final call) to "$i->inflate".
490
491       If you have built this module with zlib >= 1.2.0, the $eof parameter is
492       ignored. You can still set it if you want, but it won't be used behind
493       the scenes.
494
495   $status = $i->inflateSync($input)
496       This method can be used to attempt to recover good data from a
497       compressed data stream that is partially corrupt.  It scans $input
498       until it reaches either a full flush point or the end of the buffer.
499
500       If a full flush point is found, "Z_OK" is returned and $input will be
501       have all data up to the flush point removed. This data can then be
502       passed to the "$i->inflate" method to be uncompressed.
503
504       Any other return code means that a flush point was not found. If more
505       data is available, "inflateSync" can be called repeatedly with more
506       compressed data until the flush point is found.
507
508       Note full flush points are not present by default in compressed data
509       streams. They must have been added explicitly when the data stream was
510       created by calling "Compress::Deflate::flush"  with "Z_FULL_FLUSH".
511
512   $i->dict_adler()
513       Returns the adler32 value for the dictionary.
514
515   $i->crc32()
516       Returns the crc32 value for the uncompressed data to date.
517
518       If the "CRC32" option is not enabled in the constructor for this
519       object, this method will always return 0;
520
521   $i->adler32()
522       Returns the adler32 value for the uncompressed data to date.
523
524       If the "ADLER32" option is not enabled in the constructor for this
525       object, this method will always return 0;
526
527   $i->msg()
528       Returns the last error message generated by zlib.
529
530   $i->total_in()
531       Returns the total number of bytes compressed bytes input to inflate.
532
533   $i->total_out()
534       Returns the total number of uncompressed bytes output from inflate.
535
536   $d->get_BufSize()
537       Returns the buffer size used to carry out the decompression.
538
539   Examples
540       Here is an example of using "inflate".
541
542           use strict ;
543           use warnings ;
544
545           use Compress::Raw::Zlib;
546
547           my $x = new Compress::Raw::Zlib::Inflate()
548              or die "Cannot create a inflation stream\n" ;
549
550           my $input = '' ;
551           binmode STDIN;
552           binmode STDOUT;
553
554           my ($output, $status) ;
555           while (read(STDIN, $input, 4096))
556           {
557               $status = $x->inflate($input, $output) ;
558
559               print $output ;
560
561               last if $status != Z_OK ;
562           }
563
564           die "inflation failed\n"
565               unless $status == Z_STREAM_END ;
566
567       The next example show how to use the "LimitOutput" option. Notice the
568       use of two nested loops in this case. The outer loop reads the data
569       from the input source - STDIN and the inner loop repeatedly calls
570       "inflate" until $input is exhausted, we get an error, or the end of the
571       stream is reached. One point worth remembering is by using the
572       "LimitOutput" option you also get "ConsumeInput" set as well - this
573       makes the code below much simpler.
574
575           use strict ;
576           use warnings ;
577
578           use Compress::Raw::Zlib;
579
580           my $x = new Compress::Raw::Zlib::Inflate(LimitOutput => 1)
581              or die "Cannot create a inflation stream\n" ;
582
583           my $input = '' ;
584           binmode STDIN;
585           binmode STDOUT;
586
587           my ($output, $status) ;
588
589         OUTER:
590           while (read(STDIN, $input, 4096))
591           {
592               do
593               {
594                   $status = $x->inflate($input, $output) ;
595
596                   print $output ;
597
598                   last OUTER
599                       unless $status == Z_OK || $status == Z_BUF_ERROR ;
600               }
601               while ($status == Z_OK && length $input);
602           }
603
604           die "inflation failed\n"
605               unless $status == Z_STREAM_END ;
606

CHECKSUM FUNCTIONS

608       Two functions are provided by zlib to calculate checksums. For the Perl
609       interface, the order of the two parameters in both functions has been
610       reversed. This allows both running checksums and one off calculations
611       to be done.
612
613           $crc = adler32($buffer [,$crc]) ;
614           $crc = crc32($buffer [,$crc]) ;
615
616       The buffer parameters can either be a scalar or a scalar reference.
617
618       If the $crc parameters is "undef", the crc value will be reset.
619
620       If you have built this module with zlib 1.2.3 or better, two more CRC-
621       related functions are available.
622
623           $crc = adler32_combine($crc1, $crc2, $len2)l
624           $crc = crc32_combine($adler1, $adler2, $len2)
625
626       These functions allow checksums to be merged.
627

Misc

629   my $version = Compress::Raw::Zlib::zlib_version();
630       Returns the version of the zlib library.
631

The LimitOutput option.

633       By default "$i->inflate($input, $output)" will uncompress all data in
634       $input and write all of the uncompressed data it has generated to
635       $output. This makes the interface to "inflate" much simpler - if the
636       method has uncompressed $input successfully all compressed data in
637       $input will have been dealt with. So if you are reading from an input
638       source and uncompressing as you go the code will look something like
639       this
640
641           use strict ;
642           use warnings ;
643
644           use Compress::Raw::Zlib;
645
646           my $x = new Compress::Raw::Zlib::Inflate()
647              or die "Cannot create a inflation stream\n" ;
648
649           my $input = '' ;
650
651           my ($output, $status) ;
652           while (read(STDIN, $input, 4096))
653           {
654               $status = $x->inflate($input, $output) ;
655
656               print $output ;
657
658               last if $status != Z_OK ;
659           }
660
661           die "inflation failed\n"
662               unless $status == Z_STREAM_END ;
663
664       The points to note are
665
666       ·    The main processing loop in the code handles reading of compressed
667            data from STDIN.
668
669       ·    The status code returned from "inflate" will only trigger
670            termination of the main processing loop if it isn't "Z_OK". When
671            "LimitOutput" has not been used the "Z_OK" status means means that
672            the end of the compressed data stream has been reached or there
673            has been an error in uncompression.
674
675       ·    After the call to "inflate" all of the uncompressed data in $input
676            will have been processed. This means the subsequent call to "read"
677            can overwrite it's contents without any problem.
678
679       For most use-cases the behavior described above is acceptable (this
680       module and it's predecessor, "Compress::Zlib", have used it for over 10
681       years without an issue), but in a few very specific use-cases the
682       amount of memory required for $output can prohibitively large. For
683       example, if the compressed data stream contains the same pattern
684       repeated thousands of times, a relatively small compressed data stream
685       can uncompress into hundreds of megabytes.  Remember "inflate" will
686       keep allocating memory until all the uncompressed data has been written
687       to the output buffer - the size of $output is unbounded.
688
689       The "LimitOutput" option is designed to help with this use-case.
690
691       The main difference in your code when using "LimitOutput" is having to
692       deal with cases where the $input parameter still contains some
693       uncompressed data that "inflate" hasn't processed yet. The status code
694       returned from "inflate" will be "Z_OK" if uncompression took place and
695       "Z_BUF_ERROR" if the output buffer is full.
696
697       Below is typical code that shows how to use "LimitOutput".
698
699           use strict ;
700           use warnings ;
701
702           use Compress::Raw::Zlib;
703
704           my $x = new Compress::Raw::Zlib::Inflate(LimitOutput => 1)
705              or die "Cannot create a inflation stream\n" ;
706
707           my $input = '' ;
708           binmode STDIN;
709           binmode STDOUT;
710
711           my ($output, $status) ;
712
713         OUTER:
714           while (read(STDIN, $input, 4096))
715           {
716               do
717               {
718                   $status = $x->inflate($input, $output) ;
719
720                   print $output ;
721
722                   last OUTER
723                       unless $status == Z_OK || $status == Z_BUF_ERROR ;
724               }
725               while ($status == Z_OK && length $input);
726           }
727
728           die "inflation failed\n"
729               unless $status == Z_STREAM_END ;
730
731       Points to note this time:
732
733       ·    There are now two nested loops in the code: the outer loop for
734            reading the compressed data from STDIN, as before; and the inner
735            loop to carry out the uncompression.
736
737       ·    There are two exit points from the inner uncompression loop.
738
739            Firstly when "inflate" has returned a status other than "Z_OK" or
740            "Z_BUF_ERROR".  This means that either the end of the compressed
741            data stream has been reached ("Z_STREAM_END") or there is an error
742            in the compressed data. In either of these cases there is no point
743            in continuing with reading the compressed data, so both loops are
744            terminated.
745
746            The second exit point tests if there is any data left in the input
747            buffer, $input - remember that the "ConsumeInput" option is
748            automatically enabled when "LimitOutput" is used.  When the input
749            buffer has been exhausted, the outer loop can run again and
750            overwrite a now empty $input.
751

ACCESSING ZIP FILES

753       Although it is possible (with some effort on your part) to use this
754       module to access .zip files, there are other perl modules available
755       that will do all the hard work for you. Check out "Archive::Zip",
756       "IO::Compress::Zip" and "IO::Uncompress::Unzip".
757

CONSTANTS

759       All the zlib constants are automatically imported when you make use of
760       Compress::Raw::Zlib.
761

SEE ALSO

763       Compress::Zlib, IO::Compress::Gzip, IO::Uncompress::Gunzip,
764       IO::Compress::Deflate, IO::Uncompress::Inflate,
765       IO::Compress::RawDeflate, IO::Uncompress::RawInflate,
766       IO::Compress::Bzip2, IO::Uncompress::Bunzip2, IO::Compress::Lzma,
767       IO::Uncompress::UnLzma, IO::Compress::Xz, IO::Uncompress::UnXz,
768       IO::Compress::Lzop, IO::Uncompress::UnLzop, IO::Compress::Lzf,
769       IO::Uncompress::UnLzf, IO::Uncompress::AnyInflate,
770       IO::Uncompress::AnyUncompress
771
772       Compress::Zlib::FAQ
773
774       File::GlobMapper, Archive::Zip, Archive::Tar, IO::Zlib
775
776       For RFC 1950, 1951 and 1952 see http://www.faqs.org/rfcs/rfc1950.html,
777       http://www.faqs.org/rfcs/rfc1951.html and
778       http://www.faqs.org/rfcs/rfc1952.html
779
780       The zlib compression library was written by Jean-loup Gailly
781       gzip@prep.ai.mit.edu and Mark Adler madler@alumni.caltech.edu.
782
783       The primary site for the zlib compression library is
784       http://www.zlib.org.
785
786       The primary site for gzip is http://www.gzip.org.
787

AUTHOR

789       This module was written by Paul Marquess, pmqs@cpan.org.
790

MODIFICATION HISTORY

792       See the Changes file.
793
795       Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
796
797       This program is free software; you can redistribute it and/or modify it
798       under the same terms as Perl itself.
799
800
801
802perl v5.12.1                      2010-07-24            Compress::Raw::Zlib(3)
Impressum