You are viewing the version of this documentation from Perl 5.30.0. View the latest version

CONTENTS

NAME

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

SYNOPSIS

use Compress::Raw::Zlib ;

($d, $status) = new Compress::Raw::Zlib::Deflate( [OPT] ) ;
$status = $d->deflate($input, $output) ;
$status = $d->flush($output [, $flush_type]) ;
$d->deflateReset() ;
$d->deflateParams(OPTS) ;
$d->deflateTune(OPTS) ;
$d->dict_adler() ;
$d->crc32() ;
$d->adler32() ;
$d->total_in() ;
$d->total_out() ;
$d->msg() ;
$d->get_Strategy();
$d->get_Level();
$d->get_BufSize();

($i, $status) = new Compress::Raw::Zlib::Inflate( [OPT] ) ;
$status = $i->inflate($input, $output [, $eof]) ;
$status = $i->inflateSync($input) ;
$i->inflateReset() ;
$i->dict_adler() ;
$d->crc32() ;
$d->adler32() ;
$i->total_in() ;
$i->total_out() ;
$i->msg() ;
$d->get_BufSize();

$crc = adler32($buffer [,$crc]) ;
$crc = crc32($buffer [,$crc]) ;

$crc = crc32_combine($crc1, $crc2, $len2);
$adler = adler32_combine($adler1, $adler2, $len2);

my $version = Compress::Raw::Zlib::zlib_version();
my $flags = Compress::Raw::Zlib::zlibCompileFlags();

DESCRIPTION

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

Compress::Raw::Zlib::Deflate

This section defines an interface that allows in-memory compression using the deflate interface provided by zlib.

Here is a definition of the interface available:

($d, $status) = new Compress::Raw::Zlib::Deflate( [OPT] )

Initialises a deflation object.

If you are familiar with the zlib library, it combines the features of the zlib functions deflateInit, deflateInit2 and deflateSetDictionary.

If successful, it will return the initialised deflation object, $d and a $status of Z_OK in a list context. In scalar context it returns the deflation object, $d, only.

If not successful, the returned deflation object, $d, will be undef and $status will hold the a zlib error code.

The function optionally takes a number of named options specified as Name => value pairs. This allows individual options to be tailored without having to specify them all in the parameter list.

For backward compatibility, it is also possible to pass the parameters as a reference to a hash containing the name=>value pairs.

Below is a list of the valid options: