NAME
Compress::SelfExtracting -- create compressed scripts
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
or
bash$ perl -MCompress::SelfExtracting -e 'zfile ...' \
< myfile.txt > myfile.txt.plz
bash$ perl myfile.txt.plz > myfile.txt.copy
DESCRIPTION
Compress::SelfExtracting
allows you to create pure-Perl self-extracting scripts (or files) using a variety of compression algorithms. These scripts (files) will then be runnable (extractable) 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.
zfile
-
Like zscript, except the script it creates will print itself to standard output instead of executing.
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.
- LZ77 -- Lempel-Ziv 77
-
While its compression is significantly worse than LZW and LZSS, this method has the shortest self-extraction routine, making it useful for .signatures and very small scripts.
- LZSS -- a variant of LZ77
-
LZSS provides better compression than LZ77, and its decompression code is only slightly longer.
- LZW -- Lempel-Ziv 78-based algorithm
-
Probably the most useful algorithm, as it decompresses quickly and yields a good compression ratio. The decompression code, while longer than that for LZ77 and LZSS, is much shorter than that for BWT.
- Huffman -- Huffman character-frequency coding
-
Useful mainly as a subroutine in BWT 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, will be 8-bit clean, and will have sane line-lengths.
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.