http://www.perlmonks.org?node_id=824008

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

Monks, I'm wondering if its possible to have a self-contained Perl installation for my app that uses its own set of modules outside of the base distribution on a server. Some customers I'm working with don't allow me to install Perl modules on they're server, but I need SOAP::Lite, XML::WRITER and XML::Writer::String which are not currently installed. So I'm thinking taring up my own mini Perl environment with 5.10 and all the modules I need to run in a self-contained environment.

Are there any gotcha's here to consider. Any best ways to go about this so my app only ever uses the Perl I deployed as far as paths? Is is possible to call Perl something like:

#!/usr/local/selfcontained/perl
Where I install all my stuff to /usr/local/selfcontained/ or wherever..

Thanks... -jim

Replies are listed 'Best First'.
Re: Self contained Perl environment
by linuxer (Curate) on Feb 18, 2010 at 19:15 UTC

    Do you already know pp and PAR::Packer?

    They help you to create a single executable which contains all the stuff of your application to run as a standalone app.

    I think, there are some limitations (especially regarding OS (e.g. Linux <=> WinDOS) and maybe library versions (e.g. glibc), but it may be worth a try.

    I think you have the same limitations, when creating your own environment...

    update:
    • reordered modules; replaced PAR with PAR::Packer
    • minor text changes
      ActiveState has a program which packages your executable and environment and will run anyplace. I packaged it on Windows and moved it to a Linux machine and it worked fine. I didn't need to install anything on Linux.
Re: Self contained Perl environment
by GrandFather (Saint) on Feb 19, 2010 at 01:28 UTC
Re: Self contained Perl environment
by aflott (Beadle) on Feb 19, 2010 at 03:58 UTC
    It can be difficult depending upon how many modules you need, their dependencies and the platform you are targeting. Some modules rely on compiled XS code to link to other libraries. You'd have to bundle those as well. If you have relatively few dependencies you can probably get away with compiling Perl non-system @INC, then install all the modules you need and tar up.
Re: Self contained Perl environment
by jamsda (Novice) on Feb 19, 2010 at 21:54 UTC
    Thanks guys for all the suggestions... I will try those out and see what works the best for me. Appreciate all the responses Monks!