NAME
Compress::Zlib::Perl - (Partial) Pure perl implementation of Compress::Zlib
SYNOPSIS
use Compress::Zlib::Perl;
($i, $status) = inflateInit(-WindowBits => -MAX_WBITS);
($out, $status) = $i->inflate($buffer);
DESCRIPTION
This a pure perl implementation of Compress::Zlib's inflate API.
Inflating deflated data
Currently the only thing Compress::Zlib::Perl can do is inflate compressed data. A constructor and 3 methods from Compress::Zlib's interface are replicated:
- inflateInit -WindowBits => -MAX_WBITS
-
Argument list specifies options. Expects that the option -WindowBits is set to a negative value. In scalar context returns an
inflater
object; in list context returns this object and a status (usuallyZ_OK
) - inflate INPUT
-
Inflates this section of deflate compressed data stream. In scalar context returns some inflated data; in list context returns this data and an output status. The status is
Z_OK
if the input stream is not yet finished,Z_STREAM_END
if all the input data is consumed and this output is the final output.inflate
modifies the input parameter; at the end of the compressed stream any data beyond its end remains in INPUT. Before the end of stream all input data is consumed during theinflate
call.This implementation of
inflate
may not be as prompt at returning data as Compress::Zlib's; this implementation currently buffers the last 32768 bytes of output data until the end of the input stream, rather than attempting to return as much data as possible during inflation. - total_in
-
Returns the total input (compressed) data so far
- total_out
-
Returns the total output (uncompressed) data so far
EXPORT
- crc32 BUFFER[, CRC32]
-
Calculate and return a 32 bit checksum for buffer. CRC32 is suitably initialised if
undef
is passed in. - Z_OK
-
Constant for returning normal status
- Z_STREAM_END
-
Constant for returning end of stream
- MAX_WBITS
-
Constant to pass to inflateInit (for compatibility with Compress::Zlib)
TODO
Test and if necessary fix on big endian systems
Backport to at least 5.005_03
Fill in all the other missing Comress::Zlib APIs
BUGS
Doesn't implement all of Compress::Zlib
Doesn't emulate Compress::Zlib's error return values - instead uses
die
Slow. Well, what did you expect?
SEE ALSO
Compress::Zlib
AUTHOR
Ton Hospel wrote a pure perl gunzip program. Nicholas Clark, <nick@talking.bollo.cx<gt> turned it into a state machine and reworked the decompression core to fit Compress::Zlib's interface.
COPYRIGHT AND LICENSE
Copyright 2004 by Ton Hospel, Nicholas Clark
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.