Question

I have been using PAR:Packer (pp) to create binaries for windows for a while. They have always been understandably large (around 6-8MB), recently I updated my packages (I use stawberry perl on windows) and now it is producing binaries that are almost 20MB! I understand it is including an entire perl environment with all needed modules, but it is getting out of hand, and a little embarrassing to hand someone a simple script that is 19MB! Is there anyway to reduce the binary size? Any one know why the size has increases in the last couple releases or PAR Packer?

Was it helpful?

Solution

When you install new modules in your Perl environment (or even only upgrade some), pp will include a lot of additional files over time even if they are not used by your script. It's because pp is more safe than strict concerning what to include that it picks up a lot of useless dependencies.

The trick is to use two Perl environments. One for development and another one only for building binaries. For the building environment, start from a fresh Perl install, install PAR::Packer and only the modules needed by your application.

With my building environment, I can produce a Tk binary of only 5 Mb. With my development environment (which has a lot of junk from CPAN) on the same machine, the same script is 13 Mb.

OTHER TIPS

What difference does it make? IMHO, I wouldn't be concerned with size, only with performance

PAR doesn't hide anything from you, you wantIf you're curious to know which files get packed, if they're stripped of pod, etc etc, all you have to do is look inside unzip -d foo foo.exe

FWIW, AFAIK, the size hasn't changed, so you must be using lots and lots of modules.

  • Typical no-module-print-print-pl yields about 1.6M
  • Load Moose/Tk and you're at about 5.1M
  • Load Gtk2/Glib/Pango/Cairo/threads and you're at about 9.7M
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top