Flavio Poletti

wrapperl is a (Perl) program lets you wrap another Perl program
with some local-specific configurations.

Why would you do this, e.g. as opposed to modifying the
hash-bang line or setting PERL5LIB, or calling the perl
executable directly? Well, lazyness of course, but also the fact
that in different environments the same program might need different
configurations, and changing those configurations possibly in many
little Perl programs quickly becomes an error-prone hassle.

wrapperl provides you with a consistent, minimal and easy to setup
way to concentrate local-specific configurations in
wrapperl.env file, and be sure
that you will call your Perl program(s) with the right setup every time.

This article contains only a brief extract from the documentation to
get your feet wet; you can find the whole thing on
the GitHub repository.

Installing

Installion is easy: download wrapperl from here
and put it somewhere in the environment(s) where you need it. It is not
necessary to put it in a directory in the PATH, although it is
suggested in order to access all functionalities.

A Complete Example

Sometimes an example is worth a thousands manuals.

A few assumptions

Let’s make a few assumptions:

you will write your program prg.pl. If
you don’t even want to write one, you can copy and paste this:

Step 2: create wrapperl.env files

In each environment (development and production in our example)
You create the wrapperl.env file, which will hold configurations
that are specific for the environment it is located into.
We will put it in the same directory as prg and prg.pl.

wrapperl.env is a standard Perl file, where you can:

set the environment variable PERL5LIB to point towards the
library paths you need for loading your modules, and

set a specific perl binary by means of the $PERL variable

For our example, this is what you end up with in the development
environment: