|P is for Practical|
Upgrading Core Modules Using CPAN - Best Practice?by stocks29 (Acolyte)
|on Oct 02, 2008 at 21:13 UTC||Need Help??|
stocks29 has asked for the wisdom of the Perl Monks concerning the following question:
I am working on upgrading some core modules installed on a solaris machine used for development. I am using the CPAN shell to upgrade these modules.
The problem is that the path that the Makefile(s) wants to install the module(s) to is not the same as the location they are install to when perl is installed. That is, the "CORE" installation path (which I believe is referred to as 'perl') is different than the "CPAN" installation path (which I believe is called 'site'). This leaves us with two versions of the same module installed on the system, meaning that the version being used by applications is determined by the order of @INC, since both locations are in @INC. Currently the "CORE" path appears first, so the newer versions of such modules are not being used.
I came across this post: http://grokbase.com/post/2008/03/18/perl-and-cpan-distributors/qgHek3zF7tvfS9x8R2pwFHtSe0Q which suggests that, when recompiling perl, you set @INC to have the CPAN (or site) paths appear before the CORE (or perl) paths. This seems to make sense since you would expect the CPAN version to (in 99% of cases) be newer than the CORE version. Also, whenever a modules was upgraded the newest version would automatically be used since it would appear first in @INC.
This solution also appears to have the potential to cause issues if developers are modifying @INC in some fashion (manually or using a module) that would cause them to use the older version of the module. In this case, they could be beating their head against a wall for quite some time trying to figure out why they don't have some new functionality provided by the new version.
Another possible solution would be to somehow get the CPAN versions to clobber the CORE versions when they are upgraded. This would solve the problem, but there does not seem to be an easy way to do this. SOME core module Makefile.PLs take arguments that would allow you to change the default install location, but it is not consistent for each module. This means that putting Makefile.PL args in CPAN::Config may work for some modules but not for others. Essentially, in order to be sure, each module would have to be installed manually after having it's Makefile.PL inspected for any such arguments and even this would not work for all modules.
Does anyone know of any best practices in regards to this?