The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Compress -- Compress your code.

SYNOPSIS

  use Compress::SelfExtracting 'compress';

  $result = compress $data, OPTIONS ... ;

or

  bash$ perl -MCompress::SelfExtracting -e 'zscript ...' \
      < script.pl > compressed.pl
  bash$ ssh user@host -e perl < compressed.pl

DESCRIPTION

Compress::SelfExtracting allows you to create pure-Perl self-extracting scripts using a variety of compression algorithms. These scripts will then run on any system with a recent version of Perl.

Functions

zscript

Reads a script on standard input, and writes the compressed result to standard output.

compress

Takes a string as its first argument, and returns the compressed result.

Options

zscript and compress support the following options:

type

Which compression algorithm to use. Compress::SelfExtracting currently supports the five types of compression listed below. LZW and LZSS are probably the most useful.

BWT -- Burrows-Wheeler Transform (bzip)

Note: BWT currently only uses a single block, and is unusably slow on files larger than about 12 kilobytes. Furthermore, the standalone decompression code is significantly larger than that for other methods.

LZW -- Lempel-Ziv 78-based algorithm
LZ77 -- Lempel-Ziv 77
LZSS -- a variant of LZ77
Huffman -- Huffman character-frequency coding
standalone (default: yes)

Create a self-extracting script, rather than one using Compress::SelfExtracting::Filter.

uu (default: no)

Create a uucompressed script. The result will be one third larger, but will still be runnable, and will be 8-bit clean. Interestingly, novice programmers may find it hard to distinguish between the decompression code and the UU-encoded data.

EXPORTS

Compress::SelfExtracting exports the zscript function by default, for command-line convenience.

AUTHOR

Sean O'Rourke, <seano@cpan.org>

Bug reports welcome, patches even more welcome.

COPYRIGHT

Copyright (C) 2002 Sean O'Rourke. All rights reserved, some wrongs reversed. This module is distributed under the same terms as Perl itself. Let me know if you actually find it useful.