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.
zscript and compress support the following options:
Which compression algorithm to use. Compress::SelfExtracting currently supports the five types of compression listed below. LZW and LZSS are probably the most useful.
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.
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 provides better compression than LZ77, and its decompression code is only slightly longer.
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.
Useful mainly as a subroutine in BWT coding.
Create a self-extracting script, rather than one using Compress::SelfExtracting::Filter.
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.
To install Compress::SelfExtracting, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.