"#!/usr/bin/env perl" and using multiple environments

Timothy S. Nelson wayland at smartchat.net.au
Mon May 26 08:54:35 CDT 2003

On Sun, 25 May 2003, Bradley Dean wrote:

> Greetings folks,
> I've been considering the potential benefits of using some sort of
> self-rolled /usr/bin/env in project development when multiple environments
> are needed.
> For instance - if a projects development, testing and production
> environments use entirely separate module libraries, it would be nice not
> to have to hard code the appropriate 'use lib's.
> Now env soes have the ability to let you change specific environment
> variables, but if their are lots of changes that's going to lead to a messy
> #! at the start of each script.
> The alternative I'm considering is to have something like:
>  - env-dev
>  - env-test
>  - env-prod

	Hmm.  You could also make one called "envconf", which pulls its 
configuration from a file, and then you just pass it a command line parameter, 

envconf -e dev
envconf -e test
envconf -e prod

	That would cut down on the number of files littering your system, 
would make it easy to add extra environments, and would give the tool a 
greater general applicability than just your own project.  Then there's less 
code duplication as well :).  I don't see any reason why it wouldn't work, but 
neither am I a super-guru :).  

> Which essentially do the same thing as env, but with a (dev|test|prod)
> environment built.
> This way the #!'s become '#!/somepath/env-dev perl' for instance and al;
> should notionally be well (and there should be no need for any hard coding
> of specific 'modes' within the code itself)
> It also means that a general environment can be built up so the
> env-(dev|test|prod) can be used to construct all environments, not just the
> perl #!'s
> Anyone seen this sort of thing done, have any thoughts on the matter?

| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayland at smartchat.net.au | I am                           |

Version 3.12
GCS d+ s:- a- C++>++++$ U++ P++ L++ E- W+++ N+ w>--- V- Y+>++ 
PGP->++ R !tv b++ DI++++ D+ G e++>++++ h! y-

More information about the Melbourne-pm mailing list