Compress::SelfExtracting -- create compressed scripts
use Compress::SelfExtracting 'compress'; $result = compress $data, OPTIONS ... ;
bash$ perl -MCompress::SelfExtracting -e 'zscript ...' \ < script.pl > compressed.pl bash$ ssh user@host -e perl < compressed.pl
bash$ perl -MCompress::SelfExtracting -e 'zfile ...' \ < myfile.txt > myfile.txt.plz bash$ perl myfile.txt.plz > myfile.txt.copy
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.
Reads a script on standard input, and writes the compressed result to standard output.
Like zscript, except the script it creates will print itself to standard output instead of executing.
Takes a string as its first argument, and returns the compressed result.
compress support the following options:
Which compression algorithm to use.
Compress::SelfExtractingcurrently 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
- 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.
Compress::SelfExtracting exports the
zscript function by default, for command-line convenience.
Sean O'Rourke, <firstname.lastname@example.org>
Bug reports welcome, patches even more welcome.
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.