NAME
Data::Transform::Zlib - A Filter for RFC195[0-2]
DESCRIPTION
Data::Transform::Zlib provides a filter for performing (de-)compression using Compress::Raw::Zlib. Since it is just a wrapper around that module, it supports the same features.
METHODS
Data::Transform::Zlib implements the standard Data::Transform API. Only additions and differences are documented here.
new
new() creates a new object. It accepts the following named parameters:
- inflate
-
A hashref containing parameters suitable to pass to Compress::Raw::Zlib::Inflate().
- deflate
-
A hashref containing parameters suitable to pass to Compress::Raw::Zlib::Deflate().
The only really interesting thing to set here is -WindowBits. If you set it to WANT_GZIP (symbol exported by Compress::Raw::Zlib), it will use gzip compression instead of zlib.
See the Compress::Raw::Zlib documentation for more details.
METADATA
Due to how the zlib protocol works, it is important that you don't forget to close the stream by sending a Data::Transform::Meta::EOF packet when you're writing data. Otherwise the filter might be holding back data while waiting to see if additional data may help compression.
In case you're using this in a request/response protocol like XMPP (with stream compression enabled), you will also have to send a Data::Transform::Meta packet with the string "sync" as the content after each request/response. This makes the filter flush what is in its buffer, so you can be sure your request or response gets sent out. Otherwise, the filter might be waiting for more input to see whether it can compress the data even better, while you need the packet sent so you can get an answer from the remote side.
AUTHOR
Data::Transform::Zlib was adapted from the POE::Filter::Zlib filter which was written by Chris Williams <chris@bingosnet.co.uk>
Martijn van Beers <martijn@cpan.org> did the adapting and maintains it.
LICENSE
Copyright (c)
Chris Williams and Martijn van Beers.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU GPL, version 3.0 or higher.