Dedicated monks!

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:

$ 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.
Where did JSON::XS get installed?
find /home/jroth/perl5 -name XS.pm | grep JSON /home/jroth/perl5/lib/perl5/x86_64-linux/JSON/XS.pm
A shared directory! And where is my current perl looking for modules?
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
Does my environment have anything to do with this?
env | grep -i perl5lib PERL5LIB=/home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/ho +me/jroth/perl5/lib/perl5
Did I do that?
grep -i perl5lib ~/.bashrc ~/.bash_profile (n/t)
It appears I have two problems:

1. Under perlbrew, CPAN clients install architecture-specific files in a common tree, i.e.

/home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/jroth/perl5/lib/perl5/x86_64-linux
even though these compiled files are most certainly incompatible across perl versions.

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

/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
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?)

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.


In reply to Architecture-specific module conflicts under perlbrew by gnosti

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.