1

If I'm compiling and running various versions of Perl, what is the best way to relocate its directory if needed? For example, if I compile Perl 5.22.0 with:

./Configure -des -Dprefix=$HOME/perl522 make all make test make install 

But later realize I'd like to move it (and future builds) to a directory called $HOME/perls/perl522/ -- can it be done merely using a mv perl522 ~/perls/ command, or does the -Dprefix= command used during the initial Configure process intrinsically link that location, thus require a full re-configuration, make, test, etc...?

Is there a best practice / streamlined process for such a circumstance?

12
  • perlbrew? Commented Jul 11, 2015 at 21:44
  • ideally without perlbrew Commented Jul 11, 2015 at 22:02
  • You'll need to fix paths in Config.pm. then check if @INC was correctly updated (it's shown by perl -V) by comparing the new values with the old ones. If that's correct, you should be ok. Commented Jul 11, 2015 at 22:32
  • 1
    You'll have to tell us what it is about perlbrew that fails your criteria Commented Jul 12, 2015 at 5:03
  • 2
    Just editing Config.pm will not work. There are paths compiled into the perl binary that are used to, for example, find Config.pm. Commented Jul 12, 2015 at 8:40

1 Answer 1

1

Look in the INSTALL file in the Perl source tree, under the heading "Relocatable @INC". It's possible to do roughly what you want, but it requires compiling perl with a special flag and it has some caveats to it.

Sign up to request clarification or add additional context in comments.

3 Comments

Looks like this is the officially supported Perl way to do it. Based on the description in the INSTALL file in the source, one would need to add the -Duserelocatableinc flag at the time ./Configure is run to enable shifting the forthcoming built Perl to a new location.
For sure. But the question asked how to move it if you only realized later that you needed to move it.
Well, as long as you want to move it to a place with a path that's the same length or less than the original path, you could always just edit the hardcoded paths in the perl binary. Emacs hexl-mode works pretty well for that sort of thing.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.