The OP asked how to recompile modules installed from CPAN, not how to change their entire methodology! Every CPAN user eventually runs into this problem after an OS update which replaces the perl binary.

(unset PERL5LIB; cpan -r)

cpan -r recompiles all XS modules. Unsetting PERL5LIB first ensures that the build tools won't try to use your locally-installed modules, which aren't working yet.

This might not be enough, because some modules depend on internals of the perl executable, and will complain if they find that perl is not a supported version (e.g., it is newer than any version the module understands). The solution is to update the offending CPAN module to the latest version, which presumably supports your new perl executable:

(unset PERL5LIB; cpan install modulename)

If it isn't obvious which module is complaining, you can usually figure it out by running

strace -e open the-command-which-fails

Finally, an alternative to all of the above is to update all your CPAN modules to the latest versions and rebuild them:

(unset PERL5LIB; cpan -u)

However, this can completely hose your setup if CPAN is not currently in a consistent state. Many people don't recommend doing this without first making a backup copy of $HOME/.cpan .


In reply to Re: When you change Perl versions, how do you resync all the CPAN modules you have installed [tag://sysadmin,cpan,modules,upgrade] by jimav
in thread When you change Perl versions, how do you resync all the CPAN modules you have installed [tag://sysadmin,cpan,modules,upgrade] by metaperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.