Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do different versions of Perl require different CPAN module installations?

Tags:

perl

cpan

We have a server farm that we are slowly migrating to a new version of Perl (5.12.1). We are currently running 5.8.5. The OS will be upgraded from RedHat 4 to RedHat 5 as well, but RedHat 5 is still back on Perl 5.8.8. Thus for a while in our source tree we'll be supporting two versions of Perl.

I have been told to install the new version of Perl into our source tree, and also all of the CPAN modules we currently use. I was actualy told to 'compile' the modules with the correct version of Perl. I'm confused by this. Do some modules actually configure themselves differently for different versions of Perl? Given this, I assume I should configure a CPAN directory for each version of Perl in our tree?

Any information or 'gotchas' about this scenario?

Edit: As an additional question, will the same cpan directory (pointed to by ~/.cpan) serve for both trees, or should I link in different directories when I'm working in different trees (installing modules)?

like image 517
Leonard Avatar asked Jun 13 '10 20:06

Leonard


2 Answers

Any perl modules that use XS (compiled C code, dynamically loaded) will, in general, only work with the same version of perl that they were compiled with. This is for two reasons:

Reason one is that by default they're installed into a directory that includes the perl version number, and any other version of perl won't look into that directory.

Reason two is because the perl API can change between major versions, so even if you were to copy the libraries into the appropriate directory, they might or might not work depending on what features they use, and how different the two versions of perl are. Between 5.8 and 5.12 there are significant differences that are likely to break nearly all code.

This doesn't apply at all to pure Perl modules, though; they can be copied around freely with very few exceptions. It's only XS code that's the issue.

like image 177
hobbs Avatar answered Oct 12 '22 01:10

hobbs


Some perl modules compile and link themselves to system libraries. If you upgrade your OS there is a chance that these libs are not present anymore which will cause these modules to misbehave or not run at all. Therefore recompiling your perl modules is recommended.

If you reinstall a new version of perl from scratch on your new system then you should face no problems, as during installation the right headers and libs will be used.

like image 42
jdehaan Avatar answered Oct 12 '22 01:10

jdehaan