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

I'm trying to get the Everything Engine running on my machine, and am running into some problems with my Perl installation....

In the course of installing the many Perl Modules required by Everything, I was coerced into upgrading to 5.6.1 from 5.6.0 by the CPAN shell... I chose to install the 5.6.1 in /usr/local instead of /usr to keep applications that expected to find things in the 5.6.0 libraries from finding 5.6.1 libraries (which I did once before, and which caused all kinds of horrible entropy increase on my machine, resulting in my having to completely re-install Perl) 5.6.0 is installed via RPMs, which complain loudly at any suggestion of "upgrading" to 5.6.1 via RPM (claiming that suchandsuch RPMs require 5.6.0)

So now /usr/bin/perl points at 5.6.1, but all the libraries are under /usr/local (and there is a /usr/local/bin/perl too of course, which works fine, and a /usr/bin/perl560, also fine)

My problem (or at least, the most recent manifestation of this horrible mess...) is that when I start up apache "httpd -D HAVE_PERL restart" it complains that the PMs which it needs (ApacheDBI for instance) are not in @INC (which only has the 5.6.0 directories in it!) Is there some way to get Perl to by default look in the 5.6.1 libraries? Or to tell Apache to use Perl 5.6.1 (short of re-compiling everything?) Is there some easy way to do a holistic upgrade to 5.6.1 and get rid of the old 5.6.0 stuff without breaking anything? I'm running a RH 7.1 machine.

Any wisdom you can impart greatly appriciated.

--
If we don't change direction soon, we'll end up where we're going.

Replies are listed 'Best First'.
Re: Multiple Perl Installations
by andreychek (Parson) on Jul 01, 2001 at 10:41 UTC
    Oddly enough, a very similar question was posted about half an hour by clive_;-), and my answer to it may well be relevant (as well as the answers of other folks).

    I'll only tackle your question regarding how to make CPAN look elsewhere, others here can answer your other questions much better then myself :-) First off, I highly recommend reading his question and the answers to it. What it comes down to though, are these two hacks to get Perl to look in the right place for your modules:

  • The shell environment variable PERL5LIB acts just as @INC does.. or better said, it's like saying "use lib". Perl will search for modules in any directory listed in that variable, so you could set it for a particular user, or for the entire system in a login script.

  • Secondly, you could always remove the 5.6.0 dirs under /usr/lib/perl5, and then symlink /usr/lib/perl5 to /usr/local/lib/perl5. This would get @INC looking in the right place. While it is a hack around another problem on your system, it would certaintly get you running quickly, and by all means there's nothing wrong with that.. it's just treating the symptom though, not the actual problem.

    Again, those two points were in my previous post, but have been modified slightly for your particular problem.

    The fact that CPAN ends up installing a new version of Perl for you is a horrible bug that I won't even get into describing my feelings about here :-)

    There are ways to have multiple copies of Perl running on one system. I talked to people at YAPC who had done it. However, it seems to be quite tricky, and I wouldn't recommend it if you don't need it... the people I talked to used it simply because they wanted to test modules under multiple versions of Perl. Knowing that, I would recommend deleting one copy of Perl if you don't need it, or you may run into continous problems with both attempting to coexist on your box. If you choose to try the symlink option I mentioned above, it would be perl 5.6.0 you'd delete. Unfortunatly, you would get the same horrible error messages from RPM if you attempted to remove 5.6.0. You could always just rename the dirs and the perl binary. Just a thought. Good luck,
    -Eric
Re: Multiple Perl Installations
by chipmunk (Parson) on Jul 01, 2001 at 19:45 UTC
    Assuming you haven't moved things around since installing perl5.6.1, the reason that Apache cannot find the libraries in the 5.6.1 directories is that the web server is running the perl5.6.0. If you actually manage to get perl5.6.0 to look in the 5.6.1 directories, you will then be running perl5.6.0 with the perl5.6.1 libraries, which seems like a bad idea. (If you built 5.6.1 and then moved the directories around, your perl installation will be all confused because the contents of @INC are compiled into the perl binary.)

    I've thought of a few possible solutions:

    • Rebuild Apache for the new installation of perl5.6.1, for which you have already installed the required modules. [*]
    • Install the required modules in the perl5.6.0 CPAN shell again, but first upgrade the CPAN module so that it will not install a new version of perl itself unless you actually ask it to. (That misbehavior was finally (!) fixed.)
    • Switch over to perl5.6.1 completely, and then rebuild Apache for 5.6.1.
    You haven't given details about the problems you experienced when you upgraded to 5.6.1 previously, but I would like to point out that perl5.6.1 fixes many bugs from the 5.6.0 release; see the 5.6.1 perldelta for more details.

    * I don't know a lot about Apache; I suppose it may be possible to get Apache running with perl5.6.1 instead of perl5.6.0 without rebuilding the web server.

      "I fear that the reports of my demise have been greatly exagerated."

      - The CPAN.pm bug

      So, has it really been fixed this time? It was reported fixed and appeared to have been fixed but when 5.6.1 came out it appeared that the part of the bug fix that was required on the CPAN mirror sites had not been kept up and so the bug appeared again. Indeed, the first "fix" is certainly contained in 5.6.0's CPAN.pm.

      So, do we now have a second fix?

      And for those of you thinking, "Why don't you just check for yourself, ya lazy Saint??", the ChangeLog for the latest version of CPAN.pm according to http://search.cpan.org/ doesn't show any changes since March 1999, which was before the first fix.

              - tye (but my friends call me "Tye")
Re: Multiple Perl Installations
by zane (Acolyte) on Jul 02, 2001 at 12:30 UTC
    I have for the most part gotten this working now. I removed Perl 5.6.1, and moved the site_perl/5.6.1 to my /usr/bin, just in case... I uninstalled all the Perl RPMs using --nodeps and when my machine appeared naked of Perl, I re-installed the Perl 5.6.0 RPMs (for what seems like at least the 3rd time...). It all seems fairly clean now, and everything points to /usr/bin/perl. I re-installed all of the Perl modules that Everything requires via CPAN. 1.54 still tried to "upgrade" me to 5.6.1, but I then upgraded to 1.59 (of CPAN.pm), and it finally shut up.

    Just FYI, I learned that it is in fact possible to alter @INC (and anything else having to do with Perl) before Apache starts running, by including a directive like

    PerlRequire /path/to/startup.pl
    in httpd.conf, and putting any use or require statements you'd like to have there. Any modules sourced in there will only have one copy in memory, for all the child Apache processes, which makes it a good place to slurp up frequently used routines. This of course only applies if you've got mod_perl installed...

    My Everything still doesn't work, but at least my Perl is clean again... Getting closer though, I can tell...

    --
    If we don't change direction soon, we'll end up where we're going.