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

I'm using perlbrew, recently installed 5.42 using "perlbrew install stable". Now some programs don't work any more. For example, the error message says the version doesn't match for XS.c. How do you find out which module it means?
perl -E 'use namespace::clean' Perl API version v5.40.0 of XS.c does not match v5.42.0
perl -v This is perl 5, version 42, subversion 0 (v5.42.0) built for x86_64-li +nux Copyright 1987-2025, Larry Wall
i tried looking in ~/.cpan/work to find a XS.c file, found one in the build for List::MoreUtils::XS. try to get cpanm to install List::MoreUtils and it provides the error as the reason it can't install:
Checking whether perlapi is accessible... Perl API version v5.40.0 of +XS.c does not match v5.42.0-> N/A -> FAIL Configure failed for List-MoreUtils-0.430.

Replies are listed 'Best First'.
Re: how do you determine which module needs to be updated while using perlbrew?
by kcott (Archbishop) on Aug 01, 2025 at 16:45 UTC

    I've just installed v5.42.0 via Perlbrew using the commands shown under Quickstart:

    To install the latest stable release ...

    perlbrew install perl-5.42.0 perlbrew switch perl-5.42.0

    I'm guessing your "perlbrew install stable" would achieve the same result.

    I've also installed a number of modules, via the cpan utility, including namespace::clean. I repeated your commands:

    ken@titan ~/tmp $ perl -E 'use namespace::clean' ken@titan ~/tmp $ perl -v This is perl 5, version 42, subversion 0 (v5.42.0) built for cygwin-th +read-multi Copyright 1987-2025, Larry Wall ...

    So, there's nothing inherently wrong with the perl-5.42.0 from Perlbrew. I acknowledge that you're using Linux and I'm using Cygwin — for test commands as simple as the ones above, I don't believe this would make any difference.

    It is a fairly common mistake to copy modules from one Perl version to another; for instance, I might have tried:

    ken@titan ~/perl5/perlbrew/perls $ cp perl-5.40.0/lib/site_perl/5.40.0/namespace/clean.pm perl-5.42.0/l +ib/site_perl/5.42.0/namespace/clean.pm

    Had I done so, I could have expected an error such as you're getting. I don't know if this is what you've done but your results are suggesting something like this has occurred. Here's some basic information:

    • Modules with a compilation requirement cannot be copied successfully to a new Perl version — you must recompile them (installing from CPAN does this for you).
    • Modules which appear to be pure Perl may have dependencies with a compilation requirement — see previous point.
    • Very simple pure Perl modules with no dependencies can probably be copied safely; however, it's likely to be easier to reinstall from CPAN than going to the trouble of checking source code.

    I note ibm1620 suggested clone-modules. I've never used that but it may suit your needs. See perlbrew: COMMAND: CLONE-MODULES for documentation.

    Finally, please consider registering — see Create A New User. You won't be asked for your life story like some forums; we'll be able to tell you apart from other Anonymous Monks; and, you'll find quite a few benefits such as editing your posts, customising the GUI, and others.

    — Ken

Re: how do you determine which module needs to be updated while using perlbrew?
by Anonymous Monk on Aug 01, 2025 at 04:48 UTC
    Could be an @INC problem, show the output of perl -V please
Re: how do you determine which module needs to be updated while using perlbrew?
by ikegami (Patriarch) on Aug 02, 2025 at 00:20 UTC

    Please provide the @INC and %ENV section of at the bottom of perl -V (uppercase "V")


    To answer your question ("how do you determine which module needs to be updated while using perlbrew?"), none need upgrading. You just installed a fresh Perl, so you have no modules. You will need to install (not upgrade) the modules you need. You should have a list of the dependencies of your programs.

Re: how do you determine which module needs to be updated while using perlbrew?
by ibm1620 (Hermit) on Aug 01, 2025 at 15:35 UTC

    Guessing ... see:

    perlbrew help clone-modules

      not having perlbrew myself, I'm curious whether that provides any information besides what is online — which I'll note is quite meager.

        It appears to be the same text. But whenever I install a new release of Perl, I run perlbrew clone-modules, which copies the modules from my previous installation, upgrading any that were updated for the new release. I don't know if this will solve the OP's problem, but it seems like a good practice in any event, and would be worth a shot.