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

I need to install perl as part of a larger package on a number of different machines where the current perl installation will be unknown. To handle this I would like to include my own perl installation, but need to make the install prefix an env variable. Is that possible? Thanks

Replies are listed 'Best First'.
Re: perl install prefix as an env variable
by jeffenstein (Hermit) on Mar 13, 2002 at 18:07 UTC

    I use this little bit at the start of my scripts, as I run them on my local box with $HOME/tools/perl, and on the HP servers as /opt/perl5/bin/perl.

    #!/bin/sh PATH=$HOME/perl/bin:$HOME/tools:/opt/perl5/bin:/usr/local/bin:$PATH export PATH exec perl -S -w -x $0 ${1+"$@"} #! perl -w #line 8

    I got this one straight from perlrun. The same should work for you, but just change the $PATH to include the preferred perl version first.

      That is what I have been more or less doing, I'm just wondering if there is a way to do that when running the ./Configure file. ie some way to --prefix=$VARIABLE and have the variable stay through the build and not be substituted (and be an env variable)

        D'oh... Gotta start reading before replying.

        Can you use ./Configure -d -Dprefix=~/perl -Uinstallusrbinperl ??

        Or perhaps ./Configure -d -Dprefix="$ENV_VAR" -Uinstallusrbinperl

        Warning: not tested