Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Had to move perl to a different directory

by davidfilmer (Sexton)
on Apr 02, 2014 at 22:52 UTC ( [id://1080847]=perlquestion: print w/replies, xml ) Need Help??

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

Masters,
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 03, 2014 at 03: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 Config.pm 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

    --MidLifeXis

Re: Had to move perl to a different directory
by syphilis (Archbishop) on Apr 03, 2014 at 06: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.

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-24 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found