Microcebus has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I build standalone executables of my Perl scripts using the PAR::Packer. Everything works fine, but the size of the executable file becomes very large (~14MB). I know there is an exclude option -X but how can I know which of the modules I can exclude?

Is there a possibility to list all modules NOT needed for a certain script? Or maybe to list all modules within my PERL and all mudules needed by the script in question?

Thanks for your wisdom.

  • Comment on PAR::Packer exclude modules - but which ones?

Replies are listed 'Best First'.
Re: PAR::Packer exclude modules - but which ones?
by marto (Cardinal) on Sep 19, 2011 at 09:25 UTC
Re: PAR::Packer exclude modules - but which ones?
by Khen1950fx (Canon) on Sep 19, 2011 at 09:54 UTC
    You could make a packed .pl that relies on the target machine having a perl interpreter and core modules:
    pp -P -o out.pl script.pl
    Then unzip it:
    unzip -l out.pl | sort -n
    I tried it on a 370 byte script, and the result was a packed .pl that was 272 bytes, smaller than the original. Cool!
Re: PAR::Packer exclude modules - but which ones?
by Anonymous Monk on Sep 19, 2011 at 06:41 UTC

    but how can I know which of the modules I can exclude

    You can't :) You could Try It To See but you'll be disappointed

    Is there a possibility to list all modules NOT needed for a certain script?

    Yes, subtract the list of modules required, from the list of installed modules or cpan modules

    Super Search