I have a dated system perl 5.8.8 on a Linux machine and installed a 5.12.4 from ActiveState. Both perl’s cpan_home is ~root/.cpan. I was about to change the new perl’s cpan_home, but then I realized I didn’t know whether I really have to do this or whether it would just result in multiple copies of modules being downloaded to different directories when in fact they could be shared.
So can they? Is it safe? With regard to compiling? Or do I have to go for separate cpan_home directories?
Note that I tried perlbrew first but it failed with Can't load '../lib/auto/IO/IO.so' for module IO: ../lib/auto/IO/IO.so: wrong ELF class: ELFCLASS64 at ../lib/XSLoader.pm line 70. So instead of pursueing the issue I went for ActivePerl, which installs easily.
I have a dozen builds of Perl on my system, and they all use
~/.cpan. I have never had a problems, but I cannot say that it is safe. It depends on the settings therein. Specifically,build_dir_reuseshould (probably) be zero.makepl_argshouldn’t containINSTALL_BASE.mbuildpl_argshouldn’t contain--install_base.“Install base” overrides where the modules are installed. If you start installing the modules for all your builds in one location, you will have problems due to incompatibilities between versions, releases and builds of Perl.
If you want to share
.cpanand have a local install directory, you can probably get away with usingPREFIX=/home/username/perl5 LIB=/home/username/perl5/libinstead ofINSTALL_BASE=/home/username/perl5. It uses a smarter directory structure.By the way, local::lib causes “install base” to be used, so you’ll run into problems if you use local::lib with multiple installs of Perl.