Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Had to move perl to a different directory

by davidfilmer (Acolyte)
on Apr 02, 2014 at 18:52 UTC ( #1080847=perlquestion: print w/replies, xml ) Need Help??
davidfilmer has asked for the wisdom of the Perl Monks concerning the following question:

I had to move perl (my own compile, not system perl) to a different directory (no choice, and no cheats like symlinks). Now @INC is all wrong, and lots of the perl package (such as the cpan script) have the old location on the shebang line. I googled around and saw people who said my only option is to recompile perl (and my boatload of modules, which are a pain in the neck to install on AIX). Surely I must have a better option!!! This is perl 5.12.1.

Your humble acolyte begs your indulgence.
  • Comment on Had to move perl to a different directory

Replies are listed 'Best First'.
Re: Had to move perl to a different directory
by MidLifeXis (Monsignor) on Apr 02, 2014 at 23:12 UTC

    [The OP was updated to indicate that this was a non-system perl after my post.] I am hoping that you did not move the system perl to another location.

    A perl installation that is not explicitly relocatable is compiled with certain paths embedded in its configuration. You may be able to hack some changes into the module (ick ick ick - read: RISK), but I would agree with others that the best option is to do a rebuild for your platform.

    Also, if you are currently using the system perl for an application, and installing your own modules into that system perl, and upgrading the installed modules in the system perl, STOP. Install your own version of Perl to use with your homegrown applications. The system expects a certain perl environment, and messing with it is setting the operating system up for failure -- not a good thing. Additionally, you are tying your application to the OS vendor's whims as to what an acceptable version of Perl and modules happens to be.

    Uncouple your application from the OS's perl installation, and take control of the environment it runs within.

    Update: added OP update note


Re: Had to move perl to a different directory
by syphilis (Bishop) on Apr 03, 2014 at 02:05 UTC
    Now @INC is all wrong

    I think this can be fixed by setting the PERL5LIB environment variable to the desired directories. Delimit the different locations with whatever is specified by perl -V:path_sep

    lots of the perl package .... have the old location on the shebang line

    If that poses a problem then I don't know of any solution (apart from creating a symlink).

    There will additionally be a number of %Config values that need amending - this can be done using the same techniques as employed by ExtUtils::FakeConfig.

    However, IMO, by far your best solution is just to recompile perl. If you recompile the same version && use the same config options as the original build && install it into the new location (thereby clobbering the perl you've currently got), then you won't need to re-install any modules.

Re: Had to move perl to a different directory
by Anonymous Monk on Apr 02, 2014 at 19:27 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1080847]
Approved by igelkott
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2019-02-17 11:48 GMT
Find Nodes?
    Voting Booth?
    I use postfix dereferencing ...

    Results (96 votes). Check out past polls.