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