Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / IO::Uncompress::AnyInflate.3pm
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
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 "IO::Uncompress::AnyInflate 3"
132 .TH IO::Uncompress::AnyInflate 3 "2009-11-09" "perl v5.8.7" "User Contributed Perl Documentation"
133 .SH "NAME"
134 IO::Uncompress::AnyInflate \- Uncompress zlib\-based (zip, gzip) file/buffer
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 .Vb 1
138 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
139 .Ve
140 .PP
141 .Vb 2
142 \&    my $status = anyinflate $input => $output [,OPTS]
143 \&        or die "anyinflate failed: $AnyInflateError\en";
144 .Ve
145 .PP
146 .Vb 2
147 \&    my $z = new IO::Uncompress::AnyInflate $input [OPTS] 
148 \&        or die "anyinflate failed: $AnyInflateError\en";
149 .Ve
150 .PP
151 .Vb 7
152 \&    $status = $z\->read($buffer)
153 \&    $status = $z\->read($buffer, $length)
154 \&    $status = $z\->read($buffer, $length, $offset)
155 \&    $line = $z\->getline()
156 \&    $char = $z\->getc()
157 \&    $char = $z\->ungetc()
158 \&    $char = $z\->opened()
159 .Ve
160 .PP
161 .Vb 1
162 \&    $status = $z\->inflateSync()
163 .Ve
164 .PP
165 .Vb 9
166 \&    $data = $z\->trailingData()
167 \&    $status = $z\->nextStream()
168 \&    $data = $z\->getHeaderInfo()
169 \&    $z\->tell()
170 \&    $z\->seek($position, $whence)
171 \&    $z\->binmode()
172 \&    $z\->fileno()
173 \&    $z\->eof()
174 \&    $z\->close()
175 .Ve
176 .PP
177 .Vb 1
178 \&    $AnyInflateError ;
179 .Ve
180 .PP
181 .Vb 1
182 \&    # IO::File mode
183 .Ve
184 .PP
185 .Vb 10
186 \&    <$z>
187 \&    read($z, $buffer);
188 \&    read($z, $buffer, $length);
189 \&    read($z, $buffer, $length, $offset);
190 \&    tell($z)
191 \&    seek($z, $position, $whence)
192 \&    binmode($z)
193 \&    fileno($z)
194 \&    eof($z)
195 \&    close($z)
196 .Ve
197 .SH "DESCRIPTION"
198 .IX Header "DESCRIPTION"
199 This module provides a Perl interface that allows the reading of
200 files/buffers that have been compressed in a number of formats that use the
201 zlib compression library.
202 .PP
203 The formats supported are
204 .IP "\s-1RFC\s0 1950" 5
205 .IX Item "RFC 1950"
206 .PD 0
207 .IP "\s-1RFC\s0 1951 (optionally)" 5
208 .IX Item "RFC 1951 (optionally)"
209 .IP "gzip (\s-1RFC\s0 1952)" 5
210 .IX Item "gzip (RFC 1952)"
211 .IP "zip" 5
212 .IX Item "zip"
213 .PD
214 .PP
215 The module will auto-detect which, if any, of the supported
216 compression formats is being used.
217 .SH "Functional Interface"
218 .IX Header "Functional Interface"
219 A top-level function, \f(CW\*(C`anyinflate\*(C'\fR, is provided to carry out
220 \&\*(L"one\-shot\*(R" uncompression between buffers and/or files. For finer
221 control over the uncompression process, see the \*(L"\s-1OO\s0 Interface\*(R"
222 section.
223 .PP
224 .Vb 1
225 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
226 .Ve
227 .PP
228 .Vb 2
229 \&    anyinflate $input => $output [,OPTS] 
230 \&        or die "anyinflate failed: $AnyInflateError\en";
231 .Ve
232 .PP
233 The functional interface needs Perl5.005 or better.
234 .ie n .Sh "anyinflate $input\fP => \f(CW$output [, \s-1OPTS\s0]"
235 .el .Sh "anyinflate \f(CW$input\fP => \f(CW$output\fP [, \s-1OPTS\s0]"
236 .IX Subsection "anyinflate $input => $output [, OPTS]"
237 \&\f(CW\*(C`anyinflate\*(C'\fR expects at least two parameters, \f(CW$input\fR and \f(CW$output\fR.
238 .PP
239 \fIThe \f(CI$input\fI parameter\fR
240 .IX Subsection "The $input parameter"
241 .PP
242 The parameter, \f(CW$input\fR, is used to define the source of
243 the compressed data. 
244 .PP
245 It can take one of the following forms:
246 .IP "A filename" 5
247 .IX Item "A filename"
248 If the \f(CW$input\fR parameter is a simple scalar, it is assumed to be a
249 filename. This file will be opened for reading and the input data
250 will be read from it.
251 .IP "A filehandle" 5
252 .IX Item "A filehandle"
253 If the \f(CW$input\fR parameter is a filehandle, the input data will be
254 read from it.
255 The string '\-' can be used as an alias for standard input.
256 .IP "A scalar reference" 5
257 .IX Item "A scalar reference"
258 If \f(CW$input\fR is a scalar reference, the input data will be read
259 from \f(CW$$input\fR.
260 .IP "An array reference" 5
261 .IX Item "An array reference"
262 If \f(CW$input\fR is an array reference, each element in the array must be a
263 filename.
264 .Sp
265 The input data will be read from each file in turn. 
266 .Sp
267 The complete array will be walked to ensure that it only
268 contains valid filenames before any data is uncompressed.
269 .IP "An Input FileGlob string" 5
270 .IX Item "An Input FileGlob string"
271 If \f(CW$input\fR is a string that is delimited by the characters \*(L"<\*(R" and \*(L">\*(R"
272 \&\f(CW\*(C`anyinflate\*(C'\fR will assume that it is an \fIinput fileglob string\fR. The
273 input is the list of files that match the fileglob.
274 .Sp
275 If the fileglob does not match any files ...
276 .Sp
277 See File::GlobMapper for more details.
278 .PP
279 If the \f(CW$input\fR parameter is any other type, \f(CW\*(C`undef\*(C'\fR will be returned.
280 .PP
281 \fIThe \f(CI$output\fI parameter\fR
282 .IX Subsection "The $output parameter"
283 .PP
284 The parameter \f(CW$output\fR is used to control the destination of the
285 uncompressed data. This parameter can take one of these forms.
286 .IP "A filename" 5
287 .IX Item "A filename"
288 If the \f(CW$output\fR parameter is a simple scalar, it is assumed to be a
289 filename.  This file will be opened for writing and the uncompressed
290 data will be written to it.
291 .IP "A filehandle" 5
292 .IX Item "A filehandle"
293 If the \f(CW$output\fR parameter is a filehandle, the uncompressed data
294 will be written to it.
295 The string '\-' can be used as an alias for standard output.
296 .IP "A scalar reference" 5
297 .IX Item "A scalar reference"
298 If \f(CW$output\fR is a scalar reference, the uncompressed data will be
299 stored in \f(CW$$output\fR.
300 .IP "An Array Reference" 5
301 .IX Item "An Array Reference"
302 If \f(CW$output\fR is an array reference, the uncompressed data will be
303 pushed onto the array.
304 .IP "An Output FileGlob" 5
305 .IX Item "An Output FileGlob"
306 If \f(CW$output\fR is a string that is delimited by the characters \*(L"<\*(R" and \*(L">\*(R"
307 \&\f(CW\*(C`anyinflate\*(C'\fR will assume that it is an \fIoutput fileglob string\fR. The
308 output is the list of files that match the fileglob.
309 .Sp
310 When \f(CW$output\fR is an fileglob string, \f(CW$input\fR must also be a fileglob
311 string. Anything else is an error.
312 .PP
313 If the \f(CW$output\fR parameter is any other type, \f(CW\*(C`undef\*(C'\fR will be returned.
314 .Sh "Notes"
315 .IX Subsection "Notes"
316 When \f(CW$input\fR maps to multiple compressed files/buffers and \f(CW$output\fR is
317 a single file/buffer, after uncompression \f(CW$output\fR will contain a
318 concatenation of all the uncompressed data from each of the input
319 files/buffers.
320 .Sh "Optional Parameters"
321 .IX Subsection "Optional Parameters"
322 Unless specified below, the optional parameters for \f(CW\*(C`anyinflate\*(C'\fR,
323 \&\f(CW\*(C`OPTS\*(C'\fR, are the same as those used with the \s-1OO\s0 interface defined in the
324 \&\*(L"Constructor Options\*(R" section below.
325 .ie n .IP """AutoClose => 0|1""" 5
326 .el .IP "\f(CWAutoClose => 0|1\fR" 5
327 .IX Item "AutoClose => 0|1"
328 This option applies to any input or output data streams to 
329 \&\f(CW\*(C`anyinflate\*(C'\fR that are filehandles.
330 .Sp
331 If \f(CW\*(C`AutoClose\*(C'\fR is specified, and the value is true, it will result in all
332 input and/or output filehandles being closed once \f(CW\*(C`anyinflate\*(C'\fR has
333 completed.
334 .Sp
335 This parameter defaults to 0.
336 .ie n .IP """BinModeOut => 0|1""" 5
337 .el .IP "\f(CWBinModeOut => 0|1\fR" 5
338 .IX Item "BinModeOut => 0|1"
339 When writing to a file or filehandle, set \f(CW\*(C`binmode\*(C'\fR before writing to the
340 file.
341 .Sp
342 Defaults to 0.
343 .ie n .IP """Append => 0|1""" 5
344 .el .IP "\f(CWAppend => 0|1\fR" 5
345 .IX Item "Append => 0|1"
346 The behaviour of this option is dependent on the type of output data
347 stream.
348 .RS 5
349 .IP "* A Buffer" 5
350 .IX Item "A Buffer"
351 If \f(CW\*(C`Append\*(C'\fR is enabled, all uncompressed data will be append to the end of
352 the output buffer. Otherwise the output buffer will be cleared before any
353 uncompressed data is written to it.
354 .IP "* A Filename" 5
355 .IX Item "A Filename"
356 If \f(CW\*(C`Append\*(C'\fR is enabled, the file will be opened in append mode. Otherwise
357 the contents of the file, if any, will be truncated before any uncompressed
358 data is written to it.
359 .IP "* A Filehandle" 5
360 .IX Item "A Filehandle"
361 If \f(CW\*(C`Append\*(C'\fR is enabled, the filehandle will be positioned to the end of
362 the file via a call to \f(CW\*(C`seek\*(C'\fR before any uncompressed data is
363 written to it.  Otherwise the file pointer will not be moved.
364 .RE
365 .RS 5
366 .Sp
367 When \f(CW\*(C`Append\*(C'\fR is specified, and set to true, it will \fIappend\fR all uncompressed 
368 data to the output data stream.
369 .Sp
370 So when the output is a filehandle it will carry out a seek to the eof
371 before writing any uncompressed data. If the output is a filename, it will be opened for
372 appending. If the output is a buffer, all uncompressed data will be appened to
373 the existing buffer.
374 .Sp
375 Conversely when \f(CW\*(C`Append\*(C'\fR is not specified, or it is present and is set to
376 false, it will operate as follows.
377 .Sp
378 When the output is a filename, it will truncate the contents of the file
379 before writing any uncompressed data. If the output is a filehandle
380 its position will not be changed. If the output is a buffer, it will be
381 wiped before any uncompressed data is output.
382 .Sp
383 Defaults to 0.
384 .RE
385 .ie n .IP """MultiStream => 0|1""" 5
386 .el .IP "\f(CWMultiStream => 0|1\fR" 5
387 .IX Item "MultiStream => 0|1"
388 If the input file/buffer contains multiple compressed data streams, this
389 option will uncompress the whole lot as a single data stream.
390 .Sp
391 Defaults to 0.
392 .ie n .IP """TrailingData => $scalar""" 5
393 .el .IP "\f(CWTrailingData => $scalar\fR" 5
394 .IX Item "TrailingData => $scalar"
395 Returns the data, if any, that is present immediately after the compressed
396 data stream once uncompression is complete. 
397 .Sp
398 This option can be used when there is useful information immediately
399 following the compressed data stream, and you don't know the length of the
400 compressed data stream.
401 .Sp
402 If the input is a buffer, \f(CW\*(C`trailingData\*(C'\fR will return everything from the
403 end of the compressed data stream to the end of the buffer.
404 .Sp
405 If the input is a filehandle, \f(CW\*(C`trailingData\*(C'\fR will return the data that is
406 left in the filehandle input buffer once the end of the compressed data
407 stream has been reached. You can then use the filehandle to read the rest
408 of the input file. 
409 .Sp
410 Don't bother using \f(CW\*(C`trailingData\*(C'\fR if the input is a filename.
411 .Sp
412 If you know the length of the compressed data stream before you start
413 uncompressing, you can avoid having to use \f(CW\*(C`trailingData\*(C'\fR by setting the
414 \&\f(CW\*(C`InputLength\*(C'\fR option.
415 .Sh "Examples"
416 .IX Subsection "Examples"
417 To read the contents of the file \f(CW\*(C`file1.txt.Compressed\*(C'\fR and write the
418 uncompressed data to the file \f(CW\*(C`file1.txt\*(C'\fR.
419 .PP
420 .Vb 3
421 \&    use strict ;
422 \&    use warnings ;
423 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
424 .Ve
425 .PP
426 .Vb 4
427 \&    my $input = "file1.txt.Compressed";
428 \&    my $output = "file1.txt";
429 \&    anyinflate $input => $output
430 \&        or die "anyinflate failed: $AnyInflateError\en";
431 .Ve
432 .PP
433 To read from an existing Perl filehandle, \f(CW$input\fR, and write the
434 uncompressed data to a buffer, \f(CW$buffer\fR.
435 .PP
436 .Vb 4
437 \&    use strict ;
438 \&    use warnings ;
439 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
440 \&    use IO::File ;
441 .Ve
442 .PP
443 .Vb 5
444 \&    my $input = new IO::File "<file1.txt.Compressed"
445 \&        or die "Cannot open 'file1.txt.Compressed': $!\en" ;
446 \&    my $buffer ;
447 \&    anyinflate $input => \e$buffer 
448 \&        or die "anyinflate failed: $AnyInflateError\en";
449 .Ve
450 .PP
451 To uncompress all files in the directory \*(L"/my/home\*(R" that match \*(L"*.txt.Compressed\*(R" and store the compressed data in the same directory
452 .PP
453 .Vb 3
454 \&    use strict ;
455 \&    use warnings ;
456 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
457 .Ve
458 .PP
459 .Vb 2
460 \&    anyinflate '</my/home/*.txt.Compressed>' => '</my/home/#1.txt>'
461 \&        or die "anyinflate failed: $AnyInflateError\en";
462 .Ve
463 .PP
464 and if you want to compress each file one at a time, this will do the trick
465 .PP
466 .Vb 3
467 \&    use strict ;
468 \&    use warnings ;
469 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
470 .Ve
471 .PP
472 .Vb 7
473 \&    for my $input ( glob "/my/home/*.txt.Compressed" )
474 \&    {
475 \&        my $output = $input;
476 \&        $output =~ s/.Compressed// ;
477 \&        anyinflate $input => $output 
478 \&            or die "Error compressing '$input': $AnyInflateError\en";
479 \&    }
480 .Ve
481 .SH "OO Interface"
482 .IX Header "OO Interface"
483 .Sh "Constructor"
484 .IX Subsection "Constructor"
485 The format of the constructor for IO::Uncompress::AnyInflate is shown below
486 .PP
487 .Vb 2
488 \&    my $z = new IO::Uncompress::AnyInflate $input [OPTS]
489 \&        or die "IO::Uncompress::AnyInflate failed: $AnyInflateError\en";
490 .Ve
491 .PP
492 Returns an \f(CW\*(C`IO::Uncompress::AnyInflate\*(C'\fR object on success and undef on failure.
493 The variable \f(CW$AnyInflateError\fR will contain an error message on failure.
494 .PP
495 If you are running Perl 5.005 or better the object, \f(CW$z\fR, returned from
496 IO::Uncompress::AnyInflate can be used exactly like an IO::File filehandle.
497 This means that all normal input file operations can be carried out with
498 \&\f(CW$z\fR.  For example, to read a line from a compressed file/buffer you can
499 use either of these forms
500 .PP
501 .Vb 2
502 \&    $line = $z\->getline();
503 \&    $line = <$z>;
504 .Ve
505 .PP
506 The mandatory parameter \f(CW$input\fR is used to determine the source of the
507 compressed data. This parameter can take one of three forms.
508 .IP "A filename" 5
509 .IX Item "A filename"
510 If the \f(CW$input\fR parameter is a scalar, it is assumed to be a filename. This
511 file will be opened for reading and the compressed data will be read from it.
512 .IP "A filehandle" 5
513 .IX Item "A filehandle"
514 If the \f(CW$input\fR parameter is a filehandle, the compressed data will be
515 read from it.
516 The string '\-' can be used as an alias for standard input.
517 .IP "A scalar reference" 5
518 .IX Item "A scalar reference"
519 If \f(CW$input\fR is a scalar reference, the compressed data will be read from
520 \&\f(CW$$output\fR.
521 .Sh "Constructor Options"
522 .IX Subsection "Constructor Options"
523 The option names defined below are case insensitive and can be optionally
524 prefixed by a '\-'.  So all of the following are valid
525 .PP
526 .Vb 4
527 \&    \-AutoClose
528 \&    \-autoclose
529 \&    AUTOCLOSE
530 \&    autoclose
531 .Ve
532 .PP
533 \&\s-1OPTS\s0 is a combination of the following options:
534 .ie n .IP """AutoClose => 0|1""" 5
535 .el .IP "\f(CWAutoClose => 0|1\fR" 5
536 .IX Item "AutoClose => 0|1"
537 This option is only valid when the \f(CW$input\fR parameter is a filehandle. If
538 specified, and the value is true, it will result in the file being closed once
539 either the \f(CW\*(C`close\*(C'\fR method is called or the IO::Uncompress::AnyInflate object is
540 destroyed.
541 .Sp
542 This parameter defaults to 0.
543 .ie n .IP """MultiStream => 0|1""" 5
544 .el .IP "\f(CWMultiStream => 0|1\fR" 5
545 .IX Item "MultiStream => 0|1"
546 Allows multiple concatenated compressed streams to be treated as a single
547 compressed stream. Decompression will stop once either the end of the
548 file/buffer is reached, an error is encountered (premature eof, corrupt
549 compressed data) or the end of a stream is not immediately followed by the
550 start of another stream.
551 .Sp
552 This parameter defaults to 0.
553 .ie n .IP """Prime => $string""" 5
554 .el .IP "\f(CWPrime => $string\fR" 5
555 .IX Item "Prime => $string"
556 This option will uncompress the contents of \f(CW$string\fR before processing the
557 input file/buffer.
558 .Sp
559 This option can be useful when the compressed data is embedded in another
560 file/data structure and it is not possible to work out where the compressed
561 data begins without having to read the first few bytes. If this is the
562 case, the uncompression can be \fIprimed\fR with these bytes using this
563 option.
564 .ie n .IP """Transparent => 0|1""" 5
565 .el .IP "\f(CWTransparent => 0|1\fR" 5
566 .IX Item "Transparent => 0|1"
567 If this option is set and the input file/buffer is not compressed data,
568 the module will allow reading of it anyway.
569 .Sp
570 In addition, if the input file/buffer does contain compressed data and
571 there is non-compressed data immediately following it, setting this option
572 will make this module treat the whole file/bufffer as a single data stream.
573 .Sp
574 This option defaults to 1.
575 .ie n .IP """BlockSize => $num""" 5
576 .el .IP "\f(CWBlockSize => $num\fR" 5
577 .IX Item "BlockSize => $num"
578 When reading the compressed input data, IO::Uncompress::AnyInflate will read it in
579 blocks of \f(CW$num\fR bytes.
580 .Sp
581 This option defaults to 4096.
582 .ie n .IP """InputLength => $size""" 5
583 .el .IP "\f(CWInputLength => $size\fR" 5
584 .IX Item "InputLength => $size"
585 When present this option will limit the number of compressed bytes read
586 from the input file/buffer to \f(CW$size\fR. This option can be used in the
587 situation where there is useful data directly after the compressed data
588 stream and you know beforehand the exact length of the compressed data
589 stream. 
590 .Sp
591 This option is mostly used when reading from a filehandle, in which case
592 the file pointer will be left pointing to the first byte directly after the
593 compressed data stream.
594 .Sp
595 This option defaults to off.
596 .ie n .IP """Append => 0|1""" 5
597 .el .IP "\f(CWAppend => 0|1\fR" 5
598 .IX Item "Append => 0|1"
599 This option controls what the \f(CW\*(C`read\*(C'\fR method does with uncompressed data.
600 .Sp
601 If set to 1, all uncompressed data will be appended to the output parameter
602 of the \f(CW\*(C`read\*(C'\fR method.
603 .Sp
604 If set to 0, the contents of the output parameter of the \f(CW\*(C`read\*(C'\fR method
605 will be overwritten by the uncompressed data.
606 .Sp
607 Defaults to 0.
608 .ie n .IP """Strict => 0|1""" 5
609 .el .IP "\f(CWStrict => 0|1\fR" 5
610 .IX Item "Strict => 0|1"
611 This option controls whether the extra checks defined below are used when
612 carrying out the decompression. When Strict is on, the extra tests are
613 carried out, when Strict is off they are not.
614 .Sp
615 The default for this option is off.
616 .Sp
617 If the input is an \s-1RFC\s0 1950 data stream, the following will be checked:
618 .RS 5
619 .IP "1" 5
620 .IX Item "1"
621 The \s-1ADLER32\s0 checksum field must be present.
622 .IP "2" 5
623 .IX Item "2"
624 The value of the \s-1ADLER32\s0 field read must match the adler32 value of the
625 uncompressed data actually contained in the file.
626 .RE
627 .RS 5
628 .Sp
629 If the input is a gzip (\s-1RFC\s0 1952) data stream, the following will be checked:
630 .IP "1" 5
631 .IX Item "1"
632 If the \s-1FHCRC\s0 bit is set in the gzip \s-1FLG\s0 header byte, the \s-1CRC16\s0 bytes in the
633 header must match the crc16 value of the gzip header actually read.
634 .IP "2" 5
635 .IX Item "2"
636 If the gzip header contains a name field (\s-1FNAME\s0) it consists solely of \s-1ISO\s0
637 8859\-1 characters.
638 .IP "3" 5
639 .IX Item "3"
640 If the gzip header contains a comment field (\s-1FCOMMENT\s0) it consists solely
641 of \s-1ISO\s0 8859\-1 characters plus line\-feed.
642 .IP "4" 5
643 .IX Item "4"
644 If the gzip \s-1FEXTRA\s0 header field is present it must conform to the sub-field
645 structure as defined in \s-1RFC\s0 1952.
646 .IP "5" 5
647 .IX Item "5"
648 The \s-1CRC32\s0 and \s-1ISIZE\s0 trailer fields must be present.
649 .IP "6" 5
650 .IX Item "6"
651 The value of the \s-1CRC32\s0 field read must match the crc32 value of the
652 uncompressed data actually contained in the gzip file.
653 .IP "7" 5
654 .IX Item "7"
655 The value of the \s-1ISIZE\s0 fields read must match the length of the
656 uncompressed data actually read from the file.
657 .RE
658 .RS 5
659 .RE
660 .ie n .IP """RawInflate => 0|1""" 5
661 .el .IP "\f(CWRawInflate => 0|1\fR" 5
662 .IX Item "RawInflate => 0|1"
663 When auto-detecting the compressed format, try to test for raw-deflate (\s-1RFC\s0
664 1951) content using the \f(CW\*(C`IO::Uncompress::RawInflate\*(C'\fR module. 
665 .Sp
666 The reason this is not default behaviour is because \s-1RFC\s0 1951 content can
667 only be detected by attempting to uncompress it. This process is error
668 prone and can result is false positives.
669 .Sp
670 Defaults to 0.
671 .ie n .IP """ParseExtra => 0|1"" If the gzip \s-1FEXTRA\s0 header field is present and this option is set, it will force the module to check that it conforms to the sub-field structure as defined in \s-1RFC\s0 1952." 5
672 .el .IP "\f(CWParseExtra => 0|1\fR If the gzip \s-1FEXTRA\s0 header field is present and this option is set, it will force the module to check that it conforms to the sub-field structure as defined in \s-1RFC\s0 1952." 5
673 .IX Item "ParseExtra => 0|1 If the gzip FEXTRA header field is present and this option is set, it will force the module to check that it conforms to the sub-field structure as defined in RFC 1952."
674 If the \f(CW\*(C`Strict\*(C'\fR is on it will automatically enable this option.
675 .Sp
676 Defaults to 0.
677 .Sh "Examples"
678 .IX Subsection "Examples"
679 \&\s-1TODO\s0
680 .SH "Methods"
681 .IX Header "Methods"
682 .Sh "read"
683 .IX Subsection "read"
684 Usage is
685 .PP
686 .Vb 1
687 \&    $status = $z\->read($buffer)
688 .Ve
689 .PP
690 Reads a block of compressed data (the size the the compressed block is
691 determined by the \f(CW\*(C`Buffer\*(C'\fR option in the constructor), uncompresses it and
692 writes any uncompressed data into \f(CW$buffer\fR. If the \f(CW\*(C`Append\*(C'\fR parameter is
693 set in the constructor, the uncompressed data will be appended to the
694 \&\f(CW$buffer\fR parameter. Otherwise \f(CW$buffer\fR will be overwritten.
695 .PP
696 Returns the number of uncompressed bytes written to \f(CW$buffer\fR, zero if eof
697 or a negative number on error.
698 .Sh "read"
699 .IX Subsection "read"
700 Usage is
701 .PP
702 .Vb 2
703 \&    $status = $z\->read($buffer, $length)
704 \&    $status = $z\->read($buffer, $length, $offset)
705 .Ve
706 .PP
707 .Vb 2
708 \&    $status = read($z, $buffer, $length)
709 \&    $status = read($z, $buffer, $length, $offset)
710 .Ve
711 .PP
712 Attempt to read \f(CW$length\fR bytes of uncompressed data into \f(CW$buffer\fR.
713 .PP
714 The main difference between this form of the \f(CW\*(C`read\*(C'\fR method and the
715 previous one, is that this one will attempt to return \fIexactly\fR \f(CW$length\fR
716 bytes. The only circumstances that this function will not is if end-of-file
717 or an \s-1IO\s0 error is encountered.
718 .PP
719 Returns the number of uncompressed bytes written to \f(CW$buffer\fR, zero if eof
720 or a negative number on error.
721 .Sh "getline"
722 .IX Subsection "getline"
723 Usage is
724 .PP
725 .Vb 2
726 \&    $line = $z\->getline()
727 \&    $line = <$z>
728 .Ve
729 .PP
730 Reads a single line. 
731 .PP
732 This method fully supports the use of of the variable \f(CW$/\fR (or
733 \&\f(CW$INPUT_RECORD_SEPARATOR\fR or \f(CW$RS\fR when \f(CW\*(C`English\*(C'\fR is in use) to
734 determine what constitutes an end of line. Paragraph mode, record mode and
735 file slurp mode are all supported. 
736 .Sh "getc"
737 .IX Subsection "getc"
738 Usage is 
739 .PP
740 .Vb 1
741 \&    $char = $z\->getc()
742 .Ve
743 .PP
744 Read a single character.
745 .Sh "ungetc"
746 .IX Subsection "ungetc"
747 Usage is
748 .PP
749 .Vb 1
750 \&    $char = $z\->ungetc($string)
751 .Ve
752 .Sh "inflateSync"
753 .IX Subsection "inflateSync"
754 Usage is
755 .PP
756 .Vb 1
757 \&    $status = $z\->inflateSync()
758 .Ve
759 .PP
760 \&\s-1TODO\s0
761 .Sh "getHeaderInfo"
762 .IX Subsection "getHeaderInfo"
763 Usage is
764 .PP
765 .Vb 2
766 \&    $hdr  = $z\->getHeaderInfo();
767 \&    @hdrs = $z\->getHeaderInfo();
768 .Ve
769 .PP
770 This method returns either a hash reference (in scalar context) or a list
771 or hash references (in array context) that contains information about each
772 of the header fields in the compressed data stream(s).
773 .Sh "tell"
774 .IX Subsection "tell"
775 Usage is
776 .PP
777 .Vb 2
778 \&    $z\->tell()
779 \&    tell $z
780 .Ve
781 .PP
782 Returns the uncompressed file offset.
783 .Sh "eof"
784 .IX Subsection "eof"
785 Usage is
786 .PP
787 .Vb 2
788 \&    $z\->eof();
789 \&    eof($z);
790 .Ve
791 .PP
792 Returns true if the end of the compressed input stream has been reached.
793 .Sh "seek"
794 .IX Subsection "seek"
795 .Vb 2
796 \&    $z\->seek($position, $whence);
797 \&    seek($z, $position, $whence);
798 .Ve
799 .PP
800 Provides a sub-set of the \f(CW\*(C`seek\*(C'\fR functionality, with the restriction
801 that it is only legal to seek forward in the input file/buffer.
802 It is a fatal error to attempt to seek backward.
803 .PP
804 The \f(CW$whence\fR parameter takes one the usual values, namely \s-1SEEK_SET\s0,
805 \&\s-1SEEK_CUR\s0 or \s-1SEEK_END\s0.
806 .PP
807 Returns 1 on success, 0 on failure.
808 .Sh "binmode"
809 .IX Subsection "binmode"
810 Usage is
811 .PP
812 .Vb 2
813 \&    $z\->binmode
814 \&    binmode $z ;
815 .Ve
816 .PP
817 This is a noop provided for completeness.
818 .Sh "opened"
819 .IX Subsection "opened"
820 .Vb 1
821 \&    $z\->opened()
822 .Ve
823 .PP
824 Returns true if the object currently refers to a opened file/buffer. 
825 .Sh "autoflush"
826 .IX Subsection "autoflush"
827 .Vb 2
828 \&    my $prev = $z\->autoflush()
829 \&    my $prev = $z\->autoflush(EXPR)
830 .Ve
831 .PP
832 If the \f(CW$z\fR object is associated with a file or a filehandle, this method
833 returns the current autoflush setting for the underlying filehandle. If
834 \&\f(CW\*(C`EXPR\*(C'\fR is present, and is non\-zero, it will enable flushing after every
835 write/print operation.
836 .PP
837 If \f(CW$z\fR is associated with a buffer, this method has no effect and always
838 returns \f(CW\*(C`undef\*(C'\fR.
839 .PP
840 \&\fBNote\fR that the special variable \f(CW$|\fR \fBcannot\fR be used to set or
841 retrieve the autoflush setting.
842 .Sh "input_line_number"
843 .IX Subsection "input_line_number"
844 .Vb 2
845 \&    $z\->input_line_number()
846 \&    $z\->input_line_number(EXPR)
847 .Ve
848 .PP
849 Returns the current uncompressed line number. If \f(CW\*(C`EXPR\*(C'\fR is present it has
850 the effect of setting the line number. Note that setting the line number
851 does not change the current position within the file/buffer being read.
852 .PP
853 The contents of \f(CW$/\fR are used to to determine what constitutes a line
854 terminator.
855 .Sh "fileno"
856 .IX Subsection "fileno"
857 .Vb 2
858 \&    $z\->fileno()
859 \&    fileno($z)
860 .Ve
861 .PP
862 If the \f(CW$z\fR object is associated with a file or a filehandle, \f(CW\*(C`fileno\*(C'\fR
863 will return the underlying file descriptor. Once the \f(CW\*(C`close\*(C'\fR method is
864 called \f(CW\*(C`fileno\*(C'\fR will return \f(CW\*(C`undef\*(C'\fR.
865 .PP
866 If the \f(CW$z\fR object is is associated with a buffer, this method will return
867 \&\f(CW\*(C`undef\*(C'\fR.
868 .Sh "close"
869 .IX Subsection "close"
870 .Vb 2
871 \&    $z\->close() ;
872 \&    close $z ;
873 .Ve
874 .PP
875 Closes the output file/buffer. 
876 .PP
877 For most versions of Perl this method will be automatically invoked if
878 the IO::Uncompress::AnyInflate object is destroyed (either explicitly or by the
879 variable with the reference to the object going out of scope). The
880 exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
881 these cases, the \f(CW\*(C`close\*(C'\fR method will be called automatically, but
882 not until global destruction of all live objects when the program is
883 terminating.
884 .PP
885 Therefore, if you want your scripts to be able to run on all versions
886 of Perl, you should call \f(CW\*(C`close\*(C'\fR explicitly and not rely on automatic
887 closing.
888 .PP
889 Returns true on success, otherwise 0.
890 .PP
891 If the \f(CW\*(C`AutoClose\*(C'\fR option has been enabled when the IO::Uncompress::AnyInflate
892 object was created, and the object is associated with a file, the
893 underlying file will also be closed.
894 .Sh "nextStream"
895 .IX Subsection "nextStream"
896 Usage is
897 .PP
898 .Vb 1
899 \&    my $status = $z\->nextStream();
900 .Ve
901 .PP
902 Skips to the next compressed data stream in the input file/buffer. If a new
903 compressed data stream is found, the eof marker will be cleared and \f(CW$.\fR
904 will be reset to 0.
905 .PP
906 Returns 1 if a new stream was found, 0 if none was found, and \-1 if an
907 error was encountered.
908 .Sh "trailingData"
909 .IX Subsection "trailingData"
910 Usage is
911 .PP
912 .Vb 1
913 \&    my $data = $z\->trailingData();
914 .Ve
915 .PP
916 Returns the data, if any, that is present immediately after the compressed
917 data stream once uncompression is complete. It only makes sense to call
918 this method once the end of the compressed data stream has been
919 encountered.
920 .PP
921 This option can be used when there is useful information immediately
922 following the compressed data stream, and you don't know the length of the
923 compressed data stream.
924 .PP
925 If the input is a buffer, \f(CW\*(C`trailingData\*(C'\fR will return everything from the
926 end of the compressed data stream to the end of the buffer.
927 .PP
928 If the input is a filehandle, \f(CW\*(C`trailingData\*(C'\fR will return the data that is
929 left in the filehandle input buffer once the end of the compressed data
930 stream has been reached. You can then use the filehandle to read the rest
931 of the input file. 
932 .PP
933 Don't bother using \f(CW\*(C`trailingData\*(C'\fR if the input is a filename.
934 .PP
935 If you know the length of the compressed data stream before you start
936 uncompressing, you can avoid having to use \f(CW\*(C`trailingData\*(C'\fR by setting the
937 \&\f(CW\*(C`InputLength\*(C'\fR option in the constructor.
938 .SH "Importing"
939 .IX Header "Importing"
940 No symbolic constants are required by this IO::Uncompress::AnyInflate at present. 
941 .IP ":all" 5
942 .IX Item ":all"
943 Imports \f(CW\*(C`anyinflate\*(C'\fR and \f(CW$AnyInflateError\fR.
944 Same as doing this
945 .Sp
946 .Vb 1
947 \&    use IO::Uncompress::AnyInflate qw(anyinflate $AnyInflateError) ;
948 .Ve
949 .SH "EXAMPLES"
950 .IX Header "EXAMPLES"
951 .Sh "Working with Net::FTP"
952 .IX Subsection "Working with Net::FTP"
953 See IO::Uncompress::AnyInflate::FAQ
954 .SH "SEE ALSO"
955 .IX Header "SEE ALSO"
956 Compress::Zlib, 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::Lzop, IO::Uncompress::UnLzop, IO::Compress::Lzf, IO::Uncompress::UnLzf, IO::Uncompress::AnyUncompress
957 .PP
958 Compress::Zlib::FAQ
959 .PP
960 File::GlobMapper, Archive::Zip,
961 Archive::Tar,
962 IO::Zlib
963 .PP
964 For \s-1RFC\s0 1950, 1951 and 1952 see 
965 \&\fIhttp://www.faqs.org/rfcs/rfc1950.html\fR,
966 \&\fIhttp://www.faqs.org/rfcs/rfc1951.html\fR and
967 \&\fIhttp://www.faqs.org/rfcs/rfc1952.html\fR
968 .PP
969 The \fIzlib\fR compression library was written by Jean-loup Gailly
970 \&\fIgzip@prep.ai.mit.edu\fR and Mark Adler \fImadler@alumni.caltech.edu\fR.
971 .PP
972 The primary site for the \fIzlib\fR compression library is
973 \&\fIhttp://www.zlib.org\fR.
974 .PP
975 The primary site for gzip is \fIhttp://www.gzip.org\fR.
976 .SH "AUTHOR"
977 .IX Header "AUTHOR"
978 This module was written by Paul Marquess, \fIpmqs@cpan.org\fR. 
979 .SH "MODIFICATION HISTORY"
980 .IX Header "MODIFICATION HISTORY"
981 See the Changes file.
982 .SH "COPYRIGHT AND LICENSE"
983 .IX Header "COPYRIGHT AND LICENSE"
984 Copyright (c) 2005\-2009 Paul Marquess. All rights reserved.
985 .PP
986 This program is free software; you can redistribute it and/or
987 modify it under the same terms as Perl itself.