CPAN Not Working, Or Is It?

Home » CentOS » CPAN Not Working, Or Is It?
CentOS 12 Comments

(I’ve just tried this on a second C7 box, literally clean install, only did it on Friday, with the same results)

I’m replacing a dead F19 box with a new C7 one and I’m trying to get my Perl install completed. Ultimately, I need to get Selenium::Remote::Driver working, but I’m struggling before that.

I started off as always by using RPM’s for everything I possibly can. I then started to use CPAN for everything else. It looked like CPAN was working and things were installing “OK”.

However, as I went for bigger modules, anything that had dependences were then failing as the dependencie were installed OK but then did not appear to be available.

The last thing I’ve just tried is to update CPAN as the RPM is 1.9800 and the latest is 2.6. As you can see below, the install worked, but when it reloaded, or when I came out and went back in, it still showed 1.9800

Anyone got any ideas what I need to do?

cpan[2]> install CPAN
Running install for module ‘CPAN’
Running make for A/AN/ANDK/CPAN-2.25.tar.gz Fetching with LWP:
http://mirror.bytemark.co.uk/CPAN/authors/id/A/AN/ANDK/CPAN-2.25.tar.gz Fetching with LWP:
http://mirror.bytemark.co.uk/CPAN/authors/id/A/AN/ANDK/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/A/AN/ANDK/CPAN-2.25.tar.gz ok

CPAN.pm: Building A/AN/ANDK/CPAN-2.25.tar.gz

Importing PAUSE public key into your GnuPG keychain… done!
(You may wish to trust it locally with ‘gpg –lsign-key 450F89EC’)
Checking if your kit is complete… Looks good Writing Makefile for CPAN
Writing MYMETA.yml and MYMETA.json cp lib/CPAN.pm blib/lib/CPAN.pm cp lib/CPAN/CacheMgr.pm blib/lib/CPAN/CacheMgr.pm cp lib/CPAN/FTP/netrc.pm blib/lib/CPAN/FTP/netrc.pm cp lib/CPAN/LWP/UserAgent.pm blib/lib/CPAN/LWP/UserAgent.pm cp lib/CPAN/FTP.pm blib/lib/CPAN/FTP.pm cp lib/CPAN/Queue.pm blib/lib/CPAN/Queue.pm cp lib/CPAN/Distroprefs.pm blib/lib/CPAN/Distroprefs.pm cp lib/CPAN/Kwalify/distroprefs.yml blib/lib/CPAN/Kwalify/distroprefs.yml cp lib/App/Cpan.pm blib/lib/App/Cpan.pm cp lib/CPAN/Kwalify.pm blib/lib/CPAN/Kwalify.pm cp lib/CPAN/Module.pm blib/lib/CPAN/Module.pm cp lib/CPAN/Author.pm blib/lib/CPAN/Author.pm cp lib/CPAN/Debug.pm blib/lib/CPAN/Debug.pm cp lib/CPAN/HTTP/Credentials.pm blib/lib/CPAN/HTTP/Credentials.pm cp lib/CPAN/API/HOWTO.pod blib/lib/CPAN/API/HOWTO.pod cp lib/CPAN/Complete.pm blib/lib/CPAN/Complete.pm cp lib/CPAN/HTTP/Client.pm blib/lib/CPAN/HTTP/Client.pm cp lib/CPAN/FirstTime.pm blib/lib/CPAN/FirstTime.pm cp lib/CPAN/Exception/blocked_urllist.pm blib/lib/CPAN/Exception/blocked_urllist.pm cp lib/CPAN/Distrostatus.pm blib/lib/CPAN/Distrostatus.pm cp lib/CPAN/Admin.pm blib/lib/CPAN/Admin.pm cp lib/CPAN/Tarzip.pm blib/lib/CPAN/Tarzip.pm cp lib/CPAN/Prompt.pm blib/lib/CPAN/Prompt.pm cp lib/CPAN/URL.pm blib/lib/CPAN/URL.pm cp lib/CPAN/Version.pm blib/lib/CPAN/Version.pm cp lib/CPAN/DeferredCode.pm blib/lib/CPAN/DeferredCode.pm cp lib/CPAN/Distribution.pm blib/lib/CPAN/Distribution.pm cp lib/CPAN/Nox.pm blib/lib/CPAN/Nox.pm cp lib/CPAN/Exception/RecursiveDependency.pm blib/lib/CPAN/Exception/RecursiveDependency.pm cp lib/CPAN/Bundle.pm blib/lib/CPAN/Bundle.pm cp lib/CPAN/Plugin/Specfile.pm blib/lib/CPAN/Plugin/Specfile.pm cp lib/CPAN/Shell.pm blib/lib/CPAN/Shell.pm cp lib/CPAN/InfoObj.pm blib/lib/CPAN/InfoObj.pm cp lib/CPAN/HandleConfig.pm blib/lib/CPAN/HandleConfig.pm cp lib/CPAN/Exception/yaml_process_error.pm blib/lib/CPAN/Exception/yaml_process_error.pm cp lib/CPAN/Plugin.pm blib/lib/CPAN/Plugin.pm cp lib/CPAN/Exception/yaml_not_installed.pm blib/lib/CPAN/Exception/yaml_not_installed.pm cp lib/CPAN/Index.pm blib/lib/CPAN/Index.pm cp lib/CPAN/Kwalify/distroprefs.dd blib/lib/CPAN/Kwalify/distroprefs.dd cp lib/CPAN/Mirrors.pm blib/lib/CPAN/Mirrors.pm cp scripts/cpan-mirrors blib/script/cpan-mirrors
/usr/bin/perl -MExtUtils::MY -e ‘MY->fixin(shift)’ — blib/script/cpan-mirrors cp scripts/cpan blib/script/cpan
/usr/bin/perl -MExtUtils::MY -e ‘MY->fixin(shift)’ — blib/script/cpan Manifying blib/man1/cpan-mirrors.1
Manifying blib/man1/cpan.1
Manifying blib/man3/CPAN.3pm Manifying blib/man3/CPAN::Admin.3pm Manifying blib/man3/CPAN::Tarzip.3pm Manifying blib/man3/CPAN::Queue.3pm Manifying blib/man3/CPAN::Distroprefs.3pm Manifying blib/man3/CPAN::Version.3pm Manifying blib/man3/App::Cpan.3pm Manifying blib/man3/CPAN::Kwalify.3pm Manifying blib/man3/CPAN::Nox.3pm Manifying blib/man3/CPAN::Plugin::Specfile.3pm Manifying blib/man3/CPAN::Debug.3pm Manifying blib/man3/CPAN::HandleConfig.3pm Manifying blib/man3/CPAN::Plugin.3pm Manifying blib/man3/CPAN::API::HOWTO.3pm Manifying blib/man3/CPAN::Mirrors.3pm Manifying blib/man3/CPAN::FirstTime.3pm
ANDK/CPAN-2.25.tar.gz
/usr/bin/make — OK
Running make test PERL_DL_NONLAZY=1 /usr/bin/perl “-MExtUtils::Command::MM” “-e” “test_harness(0, ‘blib/lib’, ‘blib/arch’)”
t/*.t t/00signature.t …………… skipped: No Module::Signature found [INC
= /root/.cpan/build/CPAN-2.25-YZAzWH/blib/lib /root/.cpan/build/CPAN-2.25-YZAzWH/blib/arch /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .]
t/01loadme.t ……………… ok
t/02nox.t ………………… ok
t/03pkgs.t ……………….. ok
t/04clean_load.t ………….. ok
t/10version.t …………….. ok
t/11mirroredby.t ………….. ok
t/12cpan.t ……………….. ok
t/13tarzip.t ……………… ok
t/14forkbomb.t ……………. skipped: test only run when called with –doit t/30shell.t ………………. skipped: no Expect, maybe try env CPAN_RUN_SHELL_TEST_WITHOUT_EXPECT=1
t/31sessions.t ……………. skipped: Module::Build not installed t/41distribution.t ………… 1/20 No or no sufficiently recent CPAN::Perl::Releases installed at t/41distribution.t line 60. t/41distribution.t ………… ok
t/42distroprefs.t …………. ok
t/43distroprefspref.t ……… ok
t/44cpanmeta.t ……………. ok
t/50pod.t ………………… skipped: Test::Pod 1.00 required for testing POD
t/51pod.t ………………… ok
t/52podcover.t ……………. skipped: Test::Pod::Coverage 0.18 required for testing pod coverage t/60credentials.t …………. ok
t/70_critic.t …………….. skipped: Test::Perl::Critic only run when AUTHOR_TEST set t/71_minimumversion.t ……… skipped: running MinimumVersion test only run when AUTHOR_TEST set t/97-compile.t ……………. ok
t/97-cpanpm_output_hook.t ….. ok
t/97-expand_filenames.t ……. ok
t/97-install_hack.t ……….. ok
t/97-mock.t ………………. ok
t/97-process_options.t …….. ok
t/97-process_setup_options.t .. ok
t/97-return_values.t ………. ok
t/97-run.t ……………….. # will run ‘/usr/bin/perl -Mblib blib/script/cpan -y 2>&1’
t/97-run.t ……………….. 1/32 # will run ‘/usr/bin/perl -Mblib blib/script/cpan -h 2>&1’
t/97-run.t ……………….. ok
All tests successful. Files1, TestsI4, 9 wallclock secs ( 0.10 usr 0.03 sys + 7.47 cusr 1.02
csys = 8.62 CPU)
Result: PASS
ANDK/CPAN-2.25.tar.gz
/usr/bin/make test — OK
Running make install Manifying blib/man1/cpan-mirrors.1
Manifying blib/man1/cpan.1
Installing /root/perl5/lib/perl5/CPAN.pm Installing /root/perl5/lib/perl5/CPAN/CacheMgr.pm Installing /root/perl5/lib/perl5/CPAN/FTP.pm Installing /root/perl5/lib/perl5/CPAN/Queue.pm Installing /root/perl5/lib/perl5/CPAN/Distroprefs.pm Installing /root/perl5/lib/perl5/CPAN/Kwalify.pm Installing /root/perl5/lib/perl5/CPAN/Module.pm Installing /root/perl5/lib/perl5/CPAN/Author.pm Installing /root/perl5/lib/perl5/CPAN/Debug.pm Installing /root/perl5/lib/perl5/CPAN/Complete.pm Installing /root/perl5/lib/perl5/CPAN/FirstTime.pm Installing /root/perl5/lib/perl5/CPAN/Distrostatus.pm Installing /root/perl5/lib/perl5/CPAN/Admin.pm Installing /root/perl5/lib/perl5/CPAN/Tarzip.pm Installing /root/perl5/lib/perl5/CPAN/Prompt.pm Installing /root/perl5/lib/perl5/CPAN/URL.pm Installing /root/perl5/lib/perl5/CPAN/Version.pm Installing /root/perl5/lib/perl5/CPAN/DeferredCode.pm Installing /root/perl5/lib/perl5/CPAN/Distribution.pm Installing /root/perl5/lib/perl5/CPAN/Nox.pm Installing /root/perl5/lib/perl5/CPAN/Bundle.pm Installing /root/perl5/lib/perl5/CPAN/Shell.pm Installing /root/perl5/lib/perl5/CPAN/InfoObj.pm Installing /root/perl5/lib/perl5/CPAN/HandleConfig.pm Installing /root/perl5/lib/perl5/CPAN/Plugin.pm Installing /root/perl5/lib/perl5/CPAN/Index.pm Installing /root/perl5/lib/perl5/CPAN/Mirrors.pm Installing /root/perl5/lib/perl5/CPAN/FTP/netrc.pm Installing /root/perl5/lib/perl5/CPAN/LWP/UserAgent.pm Installing /root/perl5/lib/perl5/CPAN/Kwalify/distroprefs.yml Installing /root/perl5/lib/perl5/CPAN/Kwalify/distroprefs.dd Installing /root/perl5/lib/perl5/CPAN/HTTP/Credentials.pm Installing /root/perl5/lib/perl5/CPAN/HTTP/Client.pm Installing /root/perl5/lib/perl5/CPAN/API/HOWTO.pod Installing /root/perl5/lib/perl5/CPAN/Exception/blocked_urllist.pm Installing /root/perl5/lib/perl5/CPAN/Exception/RecursiveDependency.pm Installing /root/perl5/lib/perl5/CPAN/Exception/yaml_process_error.pm Installing /root/perl5/lib/perl5/CPAN/Exception/yaml_not_installed.pm Installing /root/perl5/lib/perl5/CPAN/Plugin/Specfile.pm Installing /root/perl5/lib/perl5/App/Cpan.pm Installing /root/perl5/man/man1/cpan-mirrors.1
Installing /root/perl5/man/man1/cpan.1
Installing /root/perl5/man/man3/CPAN.3pm Installing /root/perl5/man/man3/CPAN::Admin.3pm Installing /root/perl5/man/man3/CPAN::Tarzip.3pm Installing /root/perl5/man/man3/CPAN::Queue.3pm Installing /root/perl5/man/man3/CPAN::Distroprefs.3pm Installing /root/perl5/man/man3/CPAN::Version.3pm Installing /root/perl5/man/man3/App::Cpan.3pm Installing /root/perl5/man/man3/CPAN::Kwalify.3pm Installing /root/perl5/man/man3/CPAN::Nox.3pm Installing /root/perl5/man/man3/CPAN::Plugin::Specfile.3pm Installing /root/perl5/man/man3/CPAN::Debug.3pm Installing /root/perl5/man/man3/CPAN::HandleConfig.3pm Installing /root/perl5/man/man3/CPAN::Plugin.3pm Installing /root/perl5/man/man3/CPAN::API::HOWTO.3pm Installing /root/perl5/man/man3/CPAN::Mirrors.3pm Installing /root/perl5/man/man3/CPAN::FirstTime.3pm Installing /root/perl5/bin/cpan-mirrors Installing /root/perl5/bin/cpan Appending installation info to /root/perl5/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
ANDK/CPAN-2.25.tar.gz
/usr/bin/make install — OK

cpan[3]> reload cpan
(CPAN__unchanged__v1.9800)(CPAN::Author__unchanged__v5.5001)
(CPAN::CacheMgr__unchanged__v5.5001)(CPAN::Complete__unchanged__v5.5)
(CPAN::Debug__unchanged__v5.5001)(CPAN::DeferredCode__unchanged__v5.50)
(CPAN::Distribution__unchanged__v1.9602)(CPAN::Distroprefs__unchanged__v6)
(CPAN::Distrostatus__unchanged__v5.5)
(CPAN::Exception::RecursiveDependency..v5.5)
(CPAN::Exception::yaml_not_installed..v5.5)(CPAN::FTP__unchanged__v5.5005)
(CPAN::FTP::netrc__unchanged__v1.01)(CPAN::HandleConfig__unchanged__v5.5003)
(CPAN::Index__unchanged__v1.9600)(CPAN::InfoObj__unchanged__v5.5)
(CPAN::LWP::UserAgent….v1.9600)(CPAN::Module__unchanged__v5.5001)
(CPAN::Prompt__unchanged__v5.5)(CPAN::Queue__unchanged__v5.5001)
(CPAN::Shell__unchanged__v5.5002)(CPAN::Tarzip__unchanged__v5.5011)
(CPAN::Version__unchanged__v5.5001)
8 subroutines redefined

cpan[4]> Lockfile removed.
[root@lou ~]# cpan

cpan shell — CPAN exploration and modules installation (v1.9800)
Enter ‘h’ for help.

cpan[1]>

12 thoughts on - CPAN Not Working, Or Is It?

  • CPAN on CentOS 7 doesn’t install things in the system locations by default (and by design). This is to stop CPAN from over-writing files that actually belong to rpm packages.

    A number of things you can do. The sort of recommended way is to package the perl modules into an RPM and install them that way (so that the package managers know about them and can resolve conflicts). There are progs to do it for – look for cpanspec.

    CPAN will install the modules in ~/perl5/… by default – the “real”
    way of doing things is to @INC that location at the top of the perl script or set environment variables appropriately.

    Finally, if you must, fiddle with the CPAN configuration to install them in a system location. But be aware that things might get confused or break.

    P.

  • I have found the following page to install using cpanspec, and all went well until I actually want to build the RPM’s. Doesn’t matter what I try to build I get the same problems with the man pages being missing, and nothing gets built.

    [root@lou cpanspec]# rpmbuild -ba perl-strictures.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.H8RqZz
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd /root/rpmbuild/BUILD
    + rm -rf strictures-2.000006
    + /usr/bin/gzip -dc /root/rpmbuild/SOURCES/strictures-2.000006.tar.gz
    + /usr/bin/tar -xf –
    + STATUS=0
    + ‘[‘ 0 -ne 0 ‘]’
    + cd strictures-2.000006
    + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.WPzjcW
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd strictures-2.000006
    + /usr/bin/perl Makefile.PL INSTALLDIRS=vendor Checking if your kit is complete… Looks good Warning: prerequisite bareword::filehandles 0 not found. Warning: prerequisite indirect 0 not found. Warning: prerequisite multidimensional 0 not found. Writing Makefile for strictures Writing MYMETA.yml and MYMETA.json
    + make -j2
    cp lib/strictures/extra.pm blib/lib/strictures/extra.pm cp lib/strictures.pm blib/lib/strictures.pm Manifying blib/man3/strictures::extra.3pm Manifying blib/man3/strictures.3pm
    + exit 0
    Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.pxcIGj
    + umask 022
    + cd /root/rpmbuild/BUILD
    + ‘[‘ /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64 ‘!=’ / ‘]’
    + rm -rf /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64
    ++ dirname /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64
    + mkdir -p /root/rpmbuild/BUILDROOT
    + mkdir /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64
    + cd strictures-2.000006
    + rm -rf /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64
    + make pure_install PERL_INSTALL_ROOT=/root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64
    Manifying blib/man3/strictures::extra.3pm Manifying blib/man3/strictures.3pm Installing /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/root/perl5/lib/perl5/strictures.pm Installing /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/root/perl5/lib/perl5/strictures/extra.pm Installing /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/root/perl5/man/man3/strictures::extra.3pm Installing /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/root/perl5/man/man3/strictures.3pm
    + find /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64 -type f -name .packlist -exec rm -f ‘{}’ ‘;’
    +
    find /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64 -depth -type d -exec rmdir ‘{}’ ‘;’
    + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/root
    + /usr/lib/rpm/find-debuginfo.sh –strict-build-id -m –run-dwz –dwz-low-mem-die-limit
    10000000 –dwz-max-die-limit
    110000000 /root/rpmbuild/BUILD/strictures-2.000006
    /usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 0 CRC32s did match.
    + /usr/lib/rpm/check-buildroot
    + /usr/lib/rpm/redhat/brp-compress
    + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
    + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
    + /usr/lib/rpm/redhat/brp-python-hardlink
    + /usr/lib/rpm/redhat/brp-java-repack-jars Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.RIav4H
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd strictures-2.000006
    + make test PERL_DL_NONLAZY=1 /usr/bin/perl “-MExtUtils::Command::MM” “-e” “test_harness(0, ‘blib/lib’, ‘blib/arch’)”
    t/*.t t/crash.t ……. ok
    t/extras.t …… ok
    t/strictures.t .. ok
    All tests successful. Files=3, TestsB, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.06 cusr 0.01
    csys = 0.10 CPU)
    Result: PASS
    + exit 0
    Processing files: perl-strictures-2.000006-1.el7.noarch error: File not found by glob: /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/perl5/vendor_perl/*
    error: File not found by glob: /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/man/man3/*
    Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.QDACU6
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd strictures-2.000006
    +
    DOCDIR=/root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/doc/perl-strictures-2.000006
    + export DOCDIR
    + /usr/bin/mkdir -p /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/doc/perl-strictures-2.000006
    + cp -pr Changes /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/doc/perl-strictures-2.000006
    + cp -pr LICENSE /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/doc/perl-strictures-2.000006
    + cp -pr META.json /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/doc/perl-strictures-2.000006
    + cp -pr README /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/doc/perl-strictures-2.000006
    + exit 0

    RPM build errors:
    File not found by glob: /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/perl5/vendor_perl/*
    File not found by glob: /root/rpmbuild/BUILDROOT/perl-strictures-2.000006-1.el7.x86_64/usr/share/man/man3/*
    [root@lou cpanspec]#

  • I’m afraid I’m not expert on these things – I tend to do the naughty thing of using CPAN to install in system locations!

    But I think the .spec file generated, or the variables used for the build are not quite correct. You can see here:

    that it’s installing into …./root/perl5/ whereas here:

    it is trying to package …./usr/share/

    I think you need the help of someone who knows about .spec files!

    P.

  • Hi Peter,

    Do you have any instructiions on how to do this? I realise it’s far from ideal, but I need to get this system working, and can do it on a stand alone server.

    I did wonder if maybe my rpmbuild spec is wrong as every RPM I’m trying to create is looking in the wrong location for the man pages, and the perl module files. I commented out the line for the man pages, but can’t comment out the perl modules :)

  • It’s a long time since I’ve done it, but I think CPAN puts some variables in your .bashrc to configure the process. First you should run ‘perl -V’ to see if there are any entries that aren’t the system wide location – you are looking for the @INC path and/or variables like
    $PERL_LOCAL_LIB_ROOT

    If they are ok, at the CPAN prompt do ‘o conf’ to see what CPAN thinks the config is – I think the crucial options are the ones that start
    “mbuild_”.

    Ultimately you can redo the CPAN config by ‘o conf init’.

    The build and locations are influenced by some environment variables setup by rpmbuild – I have a feeling that the perl build process is using different locations to the rpmbuild so everything is getting confused.

    P.

  • First, use cpanm instead of the old cpan shell:

    $ sudo yum install perl-App-cpanminus

    It has a number of advantages:

    1. It’s much smarter about chasing dependencies, which is your core problem here.

    2. It autoconfigures, not requiring all that outdated stuff about “where is your FTP program,” “what mirror should I use,” and such.

    3. It’s easy to feed it a cpanfile with a curated set of dependencies for a one-command “install everything I need here” upgrade:

    https://metacpan.org/pod/distribution/Module-CPANfile/lib/cpanfile.pod

    4. When it fails, it keeps its output in a log file that’s easy to send to mailing lists when asking for help. Hint. :)

    I try to do that, too. The claim in another reply that RPM CPAN modules and cpan- or cpanm-installed modules cannot work together is incorrect.

    What is correct is that the CentOS-provided RPMs are often sufficiently outdated that they no longer work with the latest releases that cpanm wants to download by default. The older the CentOS installation, the greater the chance of this happening, and the greater the chance that it will happen to a module that’s so deeply tied into your dependency tree that it seems to break everything.

    There are three main solutions:

    1. Tell cpanm to download an older version that works with the other RPM-installed CPAN modules:

    $ sudo cpanm Foo::Bar@1.2.3

    1b: Same thing, but in cpanfile syntax:

    requires ‘Foo::Bar’, ‘== 1.2.3′;

    cpanfile is very flexible and can be given much more granular rules; see the link above.

    2. Selectively remove CPAN modules installed via RPM that conflict and let cpanm upgrade you to the latest. This works as long as the newer modules are upwards compatible with the remaining RPM-installed CPAN modules.

    3. Use a system like App::Fatpacker or Carton to bundle your app and its dependencies into a self-contained bundle that doesn’t depend on system CPAN modules:

    https://metacpan.org/release/Carton
    https://metacpan.org/pod/App::FatPacker

    I prefer using Carton with cpanfile, but others prefer the way App::Fatpacker works.

  • *snip*

    Often I end up downloading a src.rpm from Fedora for perl modules and building that.

    It means security patches are now my responsibility for it, and sometimes it has other perm module dependencies that I have to do the same thing with first, but it usually it works without too much fuss.

  • Since I’m the only other person to reply, I presume you mean something I said, but I don’t think I ever said they “cannot work together” – in fact I said that personally, I use both RPM and CPAN and install into system locations.

    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 (and the confusion that may result), and that this was deemed to be a bad thing so the default install location was changed.

    P.

  • What often happens when you have “larger” modules, they reply on libraries.  To build the perl module from source, you need to devel rpm of the library installed to link against.

    example libxml2-2.7.6-21.el6_8.1.x86_64
    libxml2-devel-2.7.6-21.el6_8.1.x86_64

    XML::Simple won’t build unless the devel is present

    CPAN isn’t real good at reporting why the build failed, just that it failed.

    What I’ve learned to  do when I have this sort of issue is to pop out of CPAN and into ~/.cpan/build.

    Locate the unpacked module and try the build manually.

    I get better errors that way.

  • 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.

    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.

    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.

  • If you mean that you do that manually, you don’t have to. The “look” command in the cpan shell or the –look option to cpanm does that automatically.

    That is, it unpacks the module and drops you into a sub-shell where you can work with the module manually.

    Back when I still had to support CentOS 5, I’d occasionally have to do this to get some modules to build because they required local edits or configuration overrides that the upstream developers didn’t want to support, its Perl being deemed too old to bother with any more.