Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Portable win32 perl application without PAR::Packer

by basiliscos (Pilgrim)
on Oct 15, 2014 at 17:52 UTC ( [id://1103945] : perlquestion . print w/replies, xml ) Need Help??

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

Hello Monks,

I would like to distribute my perl application with "open directory structure", i.e., something like:

├── app.bat                          <- just launches perl.exe with additional params
├──                           <- launcher for my application 
├── lib                              <- all dependencies
├── my-lib                           <- perl modules for my application
├── perl.exe                         <- strawberry perl executable
└── resources                        <- my app resources

Are there existing modules for that or some guides?

Thanks. WBR, Basiliscos

  • Comment on Portable win32 perl application without PAR::Packer

Replies are listed 'Best First'.
Re: Portable win32 perl application without PAR::Packer
by RonW (Parson) on Oct 15, 2014 at 18:24 UTC

    I have done something similar using the portable variant of Strawberry Perl as the foundation. It comes with a .BAT script to launch a CMD window with its environment setup for using Perl. This script can be modified to include the name of a .pl file to run.

    For my "project", I unzipped portable Strawberry and ran the .BAT script as-is. I then "installed" several modules from cpan using the cpan command as usual.

    Once I had the additional modules installed, I put my Perl programs and custom .BAT scripts to launch them in the base folder and tested it. Then I zipped the modified Strawberry "installation". My coworkers had no problems unzipping and running the programs.

    It is also possible to go a step further. With 7-Zip, I created a self-extracting archive containing a .CMD script that updated PATH in the Windows Registry. My coworkers could then just double click on the archive, which would then extract itself and "install" my programs.

    Update: Forgot to mention that the .CMD script just called a Perl program to do the registry update.

Re: Portable win32 perl application without PAR::Packer
by Anonymous Monk on Oct 16, 2014 at 22:34 UTC
Re: Portable win32 perl application without PAR::Packer
by aitap (Curate) on Oct 18, 2014 at 21:50 UTC

    Module::ScanDeps will provide you a list of dependencies of your Copy them from your Perl installation to lib/ or install a fresh copy from CPAN, specifying PERL_LOCAL_LIB_ROOT, PERL_MB_OPT, and PERL_MM_OPT accordingly. perl.exe will probably need its perl5xx.dll alongside.

    You can use Perl embedding features to build your own exe (with icon, manifest and everything) which launches the Perl interpreter, like this.

      Seems to be exactly what I looked for! Thanks a lot! As well as for the other monks too.