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

I'm VERY new to Perl--in fact, I don't know much about it at all. So thank you in advance for your patience.

I have Perl installed on my box (which someone helped me do months ago), running a groupware program called Mimerdesk (written in Perl). Yesterday when installing some other package on my box (related to PHP) it must have also installed some new Perl modules. When logging into Mimerdesk I got the following error:

Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.8.5/mach /usr/local/lib/perl5/site_perl/5.8.5 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.5/BSDPAN /usr/local/lib/perl5/5.8.5/mach /usr/local/lib/perl5/5.8.5 .) at lib/MimerDesk.pm line 136.

So I thought okay, maybe somehow DBI got uninstalled. So I grab DBI using $ perl CPAN command.

But now I get the error:

Can't locate Locale/PO.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.8.5/mach /usr/local/lib/perl5/site_perl/5.8.5 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.5/BSDPAN /usr/local/lib/perl5/5.8.5/mach /usr/local/lib/perl5/5.8.5 .) at lib/MimerDesk.pm line 136.

So I look at my folder structure and lo and behold, I have two folders under /usr/local/lib/perl5/site_perl: 5.6.1 which has tons of files in (my original full installation from months ago), and then 5.8.5 which only has a few files in (whatever was installed yesterday, and then the DBI from today).

From what I can tell, the problem is that whatever I installed yesterday changed my Perl path to 5.8.5, so now Mimerdesk is looking there instead of 5.6.1 where it should.

So I figure, okay I'll just rename my 5.8.5 folder and make it a symlink to 5.6.1. That solves the above error, but it gives me other errors - probably because I installed DBI today (yes, I know, I'm an idiot).

So now I'm really stuck because it appears that I need both the 5.8.5 and 5.6.1 folders, since some stuff in in both. So somehow I need to get Mimerdesk to search both folders for libraries. I'm not sure how to modify @INC without actually modifying the program itself. I tried setting the PERL5LIB env variable to include the 5.6.1 path, but that didn't help.

If I knew how, I would get rid of 5.8.5 altogether and just set @INC to use 5.6.1 but I don't know how.

Sorry this is long, but I figured more detail would help.

Thank you for your help!

-Francis.

Edited by davido: Added code tags around error message to improve legibility.

Replies are listed 'Best First'.
Re: Help! @INC problem
by chromatic (Archbishop) on Dec 08, 2004 at 18:14 UTC

    Unfortunately, you can't use all modules compiled for Perl 5.6.x with Perl 5.8.x due to changes in Perl between 5.6 and 5.8. The installation of Perl 5.8.5 might have updated a symbolic link, so that /usr/bin/perl points to a 5.8.5 binary instead of the 5.6.1 binary. If that's the case, you can change the link or make a shell alias to run 5.6.1 specifically, if you can find its perl. Run perl -v to see the version.

    If you really don't have Perl 5.6.1 installed anymore, you'll have to reinstall the modules under Perl 5.8, just as you did for the DBI.

      Thanks, chromatic.

      I ran perl -v which told me that my current version was 5.8.5. So although 5.6.1 is still on my system it doesn't seem to be installed.

      So I just reinstalled all the modules that I had previously installed for 5.6.1, using MCPAN, and things work again! Hurrah.

      I still have 5.6.1 on the box. Do I just let it be or should I delete that whole folder?

      Thanks again.

        If things work with 5.8.5 (and I don't know of any regressions that might affect you), it should be safe to delete the 5.6.1 folders. It won't hurt to keep them around, but if you're careful, it shouldn't hurt to delete them.

        If you're really paranoid, you might rename them and leave them be for a while to see if all of your required applications still work. When you've satisfied your paranoia, then delete them.

        Perl 5.8.x won't use those libraries by default, though, and it won't use some of them well at all.