Re: CPAN not working, or is it?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mar 11, 2019, at 5:24 PM, Pete Biggs <pete@xxxxxxxxxxxx> wrote:
> I use both RPM and CPAN and install into system locations.

That’s the advice I’m responding to: you don’t need to install CPAN modules only to system locations to make Perl-based programs work.  CPAN’s defaults on CentOS 7 are perfectly usable as-is, because CPAN is part of Perl, and Perl knows how to search multiple locations for a given package, including in CPAN’s default location *when* you run it as root.

> CPAN will install the modules in ~/perl5/

That’s only true when you run cpan or cpanm as a normal user.  If you run it as root, cpanm puts modules in a directory Perl finds by default — /usr/local/share/perl5 on CentOS 7 — but which doesn’t conflict with CPAN modules installed via RPM.

~/perl5 isn’t in @INC by default, though, so that’s why Perl fails to find modules installed there by default.

However, there are a bunch of ways to adjust @INC to suit local needs, so installing to ~/perl5 isn’t always a problem:

   https://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations

A useful variant on one of those methods is to put lib/ in a known location relative to the main program, then use the FindBin module to adjust @INC at run time via “use lib”:

    https://perldoc.perl.org/FindBin.html

The second class of problems I think I covered adequately in my first reply.

> All I was trying to do was to explain to Gary *why* his CPAN installs
> weren't working as expected, and that it is because of the possibility
> of CPAN over-writing RPM installed modules

That’s why you don’t want to be telling CPAN to install to system locations in the first place.  RPMs and cpanm-installed libraries should never conflict on disk.

They may conflict in their dependency graphs, of course, which again takes us back to my advice in the prior reply for managing dependencies.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux