++ed by:
4 non-PAUSE users
Author image Marc A. Lehmann


perlstrip - make perl sources smaller by removing comments, pod, whitespace...


   perlstrip file...
   perlstrip --size --cache file...

   -v                verbose
   --size            optimise for size (also: -s)
   --cache           use a cache (also: -c)
   --cache-dir path  cache directory to use
   --output path     output file for next input file (also: -o)

WARNING: like its counterpart strip, by default files are overwritten!


This program can be used to reduce the filesize of perl sources, for example, before bundling them using PAR, App::Staticperl, or when using them in a situation where disk space is premium (such as within firmwares, boot floppies etc.).

It does this by removing unnecessary whitespace, commands, POD and a few other things.

By default, it works through the list of files given on the commandline, strips them and writes them again. This can be influenced via switches.



Increases verbosity - highly recommended for interactive use.

--output path
-o path

Write the stripped contents of the following files on the commandline to this path, instead of overwriting the original file. This can be used to copy files instead of (destructively) overwriting them, by specifying -o before each file, e.g.:

   perlstrip -o strippedfile origsource

Optimise for size instead of for compressibility - the default is to optimise the file for later compression. Optimising for size makes the raw file size smaller, but might compress a bit worse.


Stripping files can take a very long time. When this option is enabled, then perlstrip will cache larger files in a special directory (default: ~/.cache/perlstrip), to improve repeated calls to strip sources.

This is mainly useful when you strip a whole perl installation repeatedly.

--cache-dir path

Enables caching, but uses an alternative cache directory (which will be created if it doesn't exist yet).


App::Staticperl, Perl::Squish.


 Marc Lehmann <schmorp@schmorp.de>