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

...I indeed need some wisdom here

I have a perl script (that calls other external perl scripts) that references all necessary external modules in multiple directories such as perlModules/, LibXML/, etc...

...so in this case, I can execute the main script which calls to the external scripts and referencing the module locations on any perl version and; it works flawlessly. Tested on 5.10 and 5.16

Because the number of referenced directories and script calls from the main perl script (I have no control over consolidating the number of scripts and directories by the way), I would like to bundle this into a single (or 2 file set) executable so that it can be executed across multiple perl versions like I can currently do if it was not bundled up...

NOTE: The machines I will be dealing with are tightly controlled so there isn't a whole lot I can do to ensure a CPAN/YUM modules can be installed. (1) oracle linux 6.4 with perl 5.10 and (2) oracle linux 7.2 with perl 5.16

I have tried:

PAR, but the target machine(s) do not have PAR installed. Creating the bundle from par.pl and zip, using parl or even executing the par archive using: perl -MPAR=./local.par <script_name> causes issues (which can be discussed later). I DO think this is the best option and am willing to push forward in ensuring a module gets installed if necessary but looking for a simple solution which escapes me at this point

PAR::Packer, but it diligently tries to install the bootstrap modules (thanks Scan::Deps) which causes cross platform issues

Sorry that some of the details are vague here so all I am looking for at this point is to be pointed in the right direction on how to implement using a free packaging solution. Thanks in advance!

Replies are listed 'Best First'.
Re: stand-alone perl script(s)
by Anonymous Monk on Apr 10, 2016 at 00:28 UTC

    ... executable so that it can be executed across multiple perl versions ...

    :) Its not going to happen, its fantasy that serves no real purpose

    If you're going to ship an .exe, ship everything thats needed to run it, that means perl and modules

    Easiest option is a portable perl, install whats needed, then copy/paste :) createdistribution/createexecutable ) or cavapackager or just plain portable strawberryperl

Re: stand-alone perl script(s)
by dasgar (Priest) on Apr 11, 2016 at 02:23 UTC

    It sounds like you're trying to use the system Perl. I believe that it usually is a good idea to not use the system Perl anything more than a simple one liner.

    If you really want to stay with the system Perl and you're not using any modules that need to be compiled (such as XS based modules), you can try using App::FatPacker which will "pack your dependencies onto your script file".

    I'm not too experienced with Linux in general, but here's the approach that I would take. First, I would get away from using the system Perl. Since I probably would struggle to compile Perl from the source code, I would go the route of using perlbrew. After that, I would install all of the modules that I needed and also install PAR::Packer. Then I would use the pp utility from PAR::Packer to make a stand-alone executable, which could then be distributed and used on other systems.

    I don't know if that is the "best" way to do things, but that would be my approach.