gnosti has asked for the wisdom of the Perl Monks concerning the following question:
I'm in search of wisdom regarding perlbrew, specifically about controlling where perlbrew installs architecture-specific (i.e. compiled) modules.
I have installed perlbrew in standard fashion, used it to install a few versions of perl, and then installed some modules. But my architecture-specific files are going to a common tree, leading to this type of error:
Where did JSON::XS get installed?$ which perl /home/jroth/perl5/perlbrew/perls/perl-5.16.3/bin/perl perl -M JSON::XS -e 1 Perl API version v5.14.0 of JSON::XS does not match v5.16.0 at /home/j +roth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/XSLoader.pm line 92. Compilation failed in require. BEGIN failed--compilation aborted.
A shared directory! And where is my current perl looking for modules?find /home/jroth/perl5 -name XS.pm | grep JSON /home/jroth/perl5/lib/perl5/x86_64-linux/JSON/XS.pm
Does my environment have anything to do with this?perl -E 'say join $/, @INC' /home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/jroth/perl5/lib/perl5/x86_64-linux /home/jroth/perl5/lib/perl5 /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_ +64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3
Did I do that?env | grep -i perl5lib PERL5LIB=/home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/ho +me/jroth/perl5/lib/perl5
It appears I have two problems:grep -i perl5lib ~/.bashrc ~/.bash_profile (n/t)
1. Under perlbrew, CPAN clients install architecture-specific files in a common tree, i.e.
even though these compiled files are most certainly incompatible across perl versions./home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/jroth/perl5/lib/perl5/x86_64-linux
2. Under perlbrew, perl looks for architecture-specific files in a common tree, even though there are appropriate directories specific to each version of perl, i.e. one of
My questions are then, how to to set the preferences for a CPAN client under perlbrew to install to the latter set of directories (whether arguments, environment settings or patches?)/home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_ +64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3
And similarly, to remove the former architecture-specific-shared directories from the PERL5LIB environment variable.
I'm confused that with perlbrew being around so long and having such a good reputation, no else seems to have this fundamental complaint and no bug has been filed against perlbrew on this issue.
Well there is a question at stackoverflow How can Install multiple Perl versions without them tripping over each other's XS modules? although the only answer is brian d foy's "don't use perlbrew, give each perl binary a version, i.e. perl-5.16.3 and let them find their own installed modules".
And there is Kent NL's post, although I didn't find it helpful, as cpanm clients continued installed to the shared tree, even after installing cpanm for each perl version.
Thanks for your interest and support!
UPDATE: For reasons unclear, my PERL5LIB environment variable is no longer set, and perlbrew is now behaving properly. I think it's possible that one of the terminals I was working had retained environment settings from local::lib, even after I had cleaned out those settings from .bashrc.
UPDATE 2: I've filed a bug against perlbrew, suggesting a warning on detecting any non-null PERL5LIB setting.
|
|---|