Chris Cooper
Chris Cooper

Reputation: 17564

Install perl so it can be accessed at multiple paths

I have perl installed on a cluster drive at /clusterhome/myperl, and the same /clusterhome directory mounted on a workstation computer at /home/chris/cluster

Running perl obviously works fine from the cluster, but when I run /home/chris/cluster/myperl/bin/perl from my workstation, it can't find any modules. The @INC is still set to

/clusterhome/myperl/lib/site_perl/5.16.3/x86_64-linux
/clusterhome/myperl/lib/site_perl/5.16.3
/clusterhome/myperl/lib/5.16.3/x86_64-linux
/clusterhome/myperl/lib/5.16.3

This happens even with the following environment variable values prepended on the workstation:

PATH            /home/chris/cluster/myperl/bin
PERL5LIB        /home/chris/cluster/myperl/lib
LD_LIBRARY_PATH /home/chris/cluster/myperl/lib
MANPATH         /home/chris/cluster/myperl/man

Is there a way I can get this perl to work on both the cluster and the workstation? I reinstall it often (nightly), so if extra make flags are required, it's totally fine.

Upvotes: 0

Views: 159

Answers (1)

Laszlo Valko
Laszlo Valko

Reputation: 2743

The exact installation location (where to look at for module inclusion) is compiled into the binaries of perl. There are other uses for the installation directory name (for example, when compiling new modules, a bunch of compilation options are provided from these compiled-in strings).

So, you have the following options:

  • you make sure that the files are available on every computer in the directory where they were designed to be (symlinks: ln -s, bind mounting: mount -o bind, or mounting there upfront),

  • you compile a new perl for every new location.

You may also disregard this compiled-in directory, and specify the directories to be used every time you want to use perl via some command-line or environment variable. For @INC, you can use command-line option -Idirectory.

Upvotes: 3

Related Questions