use Compress::LZW::Compressor; my $c = Compress::LZW::Compressor->new(); my $lzw = $c->compress( $some_data );
Block mode is a feature added to LZW by compress(1). Once the maximum code size has been reached, if the compression ratio falls (NYI) the code table and code size can be reset, and a code indicating this reset is embedded in the output stream.
May be 0 or 1.
Maximum size in bits that code output may scale up to. This value is stored in byte 3 of the compressed output so the decompressor can also stop at the same size automatically. Maximum code size implies a maximum code table size of "2 ** max_code_size", which can be emptied and restarted mid-stream in "block_mode".
May be between 9 and 31, inclusive. The default of 16 is the largest supported by compress(1), but Compress::LZW can handle up to 31 bits.
Resets the following internal state: Code table, next code number, code size, output buffer, buffer position
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.