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

Hi,

We have several Centos servers working with a custom compiled Perl, mod_perl, php etc. I am trying to recreate a local running dev version on Ubuntu (and basically any Linux machine).

Currently all the working code points to /usr/bin/perl, but the custom install script puts it in /opt/perl/bin and then creats a symlink to /usr/bin/perl (not sure this is a good idea, but its there currently).

The problem I'm then experiencing when trying to replicate, is I get errors like Can't locate Debconf/Log.pm in @INC; (@INC contains /opt/lib/site_perl/5.14.2/i686-linux /opt/lib/site_perl/5.14.2/ /opt/perl/lib/site_perl/5.14.2/ /opt/perl/lib/site_perl/5.14.2/i686-linux /opt/perl/lib/site_perl/5.14.2/) so I can't do things like apt-get upgrade without that error

I suspect its because the custom perl install has overwritten the system perl which would be looking elsewhere (I can see this file in /usr/share/perl5/Debconf for example).

Is this likely the problem (or have I misunderstood), and if so is there a solution like letting apt use the right libs, or compile perl to try /usr/share/perl5 if a module isn't found? (I suspect the better solution long term would be have all the custom scripts point to /opt/bin/perl and leave /usr/bin/perl in tact, but is there an interim solution?)

Any help greatly appreciated.

Replies are listed 'Best First'.
Re: Perl build and ubuntu problem...
by aitap (Curate) on May 29, 2013 at 05:30 UTC

    Firstly, you may have to install cdebconf (which is written in C instead of perl) to make package management work before you restore your system perl. Secondly, reinstall the "perl" package (either by downloading it from http://packages.ubuntu.com/ or by APT which should start working after installing cdebconf).

    Another option might be putting all Debconf-related modules into /opt/perl/lib/... (somewhere info @INC), since debconf is written in pure Perl (without XS).

    You can also just unpack the perl package file using dpkg-deb and put the real /usr/bin/perl back.

    Overwriting /usr/bin/perl is not a good idea, consider changing install scripts to modify (at least) PATH and PERL5LIB environment variables. Also, have a look at perlbrew and perlall, which also automate installing non-system perl without breaking things.

      Just wanted to say thanks. This has got me sorted until I can sort a better long term solution.

      For the record in case it helps others, I did an ln -s /usr/share/perl5/Debconf /opt/perl/lib/site_perl/5.14.2/ which has allowed system package management to work with APT and perl to coexist. I'll try and rearrange some of the other bits as well in future so this isn't needed, as well as look at perlbrew.