Hi,

I use the PERL5LIB environment variable to specify additional module directories to search (and I gave my reasons here).

My problem is that now I am starting to play with perl 5.6.0, so a lot of my existing modules need to be recompiled. Since the standard installation procedure creates version-specific directories under the PREFIX you specify, I thought it would be a simple matter of installing the new 5.6.0 modules under the same hierarchy and perl would find them automatically depending on which version I was running.

Wrong. See, my PERL5LIB variable used to contain:

/p/perl/lib:/p/perl/lib/site_perl/5.005:/p/perl/lib/site_perl/5.005/su +n4-solaris: /p/perl/lib/sun4-solaris
Where "/p/perl" is my directory for "local modules, installed without root privileges".

When I install some modules with 5.6.0, using the same PREFIX of "/p/perl", it correctly creates /p/perl/lib/site_perl/5.6.0, etc. However, my PERL5LIB does not work, because it explicitly mentions the 5.005 directories. I tried shortening it to:

/p/perl/lib:/p/perl/lib/site_perl:/p/perl/lib/sun4-solaris
Hoping that perl would automatically search the version- and architecture-specific directories, but it does not work. It doesn't find a lot of my modules.

From the perlrun man page:

PERL5LIB    A colon-separated list of directories in which
            to look for Perl library files before looking in
            the standard library and the current directory.
            Any architecture-specific directories under the
            specified locations are automatically included
            if they exist.
But it doesn't mention anything about version-specific directories.

Any ideas? What I would like to do is able to run both versions of perl (5.005 and 5.6.0) with the same PERL5LIB settings, and have it automatically search the correct directories. I do not want to have to include "use lib" statements in my scripts (part of what I am doing is precisely checking whether any of my existing scripts break under 5.6.0).

Thanks a lot!
--Diego


In reply to How to automatically search version- and architecture-specific module directories by ZZamboni

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.