If I want to install a CPAN module in a location that doesn't interfere with my package manager, I typically use
perl Makefile.PL INSTALLBASE=/home/me/perl-lib
and then use

PERL5LIB=/home/me/perl-lib/lib/perl5 perl-script
to run scripts using that new hierarchy of perl libs.

However, instead of using an ENV variable, I'd like to use code like

use lib '/home/me/perl-lib/lib/perl5';
which, unfortunately, and contrary to the explanation in perlrun, isn't the same. For example, if you have architecture-dependent code that ends up in something like /home/me/perl-lib/lib/perl5/i686-linux-thread-multi, then PERL5LIB set to /home/me/perl-lib/lib/perl5 will find it, while 'use lib' won't.

Questions:

  1. What are you doing to keep Perl modules installed by your package manager and CPAN modules separate?
  2. Is INSTALLBASE still the recommended way of installing modules in a different than the standard location with MakeMaker?
  3. Is there a directive in Perl that does what PERL5LIB does (without using PERL5LIB)?
Thanks for any insight.

In reply to PERL5LIB different than 'use lib' by saintmike

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.