views:

47

answers:

1

Supposing I have one perl in /usr/bin (which came along with my os-distribution) and another one (build form the source) in /usr/local/bin – is there a simple way to make a module available to both perl-installations with only one cpan; install module-name?

+4  A: 

As long as you put the module in a place where both Perls can find it in their include path, for instance via the environment variable PERL5LIB, it should just work.

You could define a separate directory for these shared modules and tell cpan to install into this directory. See the excellent Using CPAN with a non-root account for how to do that. Then add this directory to both Perls' PERL5LIB.

Thomas Kappler
This isn't a great idea for any module that depends on a feature that is only available in certain versions of Perl. I think some XS modules also are compiled differently depending on the target Perl version number.
Ether
True. It also doesn't address the dependencies of the module in question - do you want them also in just one place, or separate for each Perl? It's a tricky problem, and my solution is just for the common case. Thanks for pointing that out.
Thomas Kappler