Hello,

I am having a problem using PERL5LIB. I have a directory 'H:/tools/perl_libs/' that is mapped to a Windows remote drive. My PERL5LIB environment variable is set as:

PERL5LIB="H:/tools/perl_libs C:/Perl_5_8_8_822/lib C:/Perl_5_8_8_822/site/lib"

The following code fails. I expect it to find <H:/tools/perl_libs/Memory.pm> as defined in PERL5LIB, but it does not. The code and the error message are provided below:

Code
use strict; #use lib 'H:/tools/perl_libs'; use Memory; use Does::Not::Exist;
Output
Can't locate Memory.pm in @INC (@INC contains: H:/tools/perl_libs C:/Perl_5_8_8_822/lib C:/Perl_5_8_8_822/site/lib C:/Perl_5_8_8_822/site/lib C:/Perl_5_8_8_822/lib .) at ...

The following code works just fine. Memory.pm is found. For whatever reason, defining my directory with use lib ... works but defining in PERL5LIB doesn't seem to. The use Does::Not::Exist; is used to cause a failure and dump the @INC array. Note that <H:/tools/perl_libs> appears as the first two entries in @INC.

Code
use strict; use lib 'H:/tools/perl_libs'; use Memory; use Does::Not::Exist;
Output
Can't locate Does/Not/Exist.pm in @INC (@INC contains: H:/tools/perl_libs H:/tools/perl_libs C:/Perl_5_8_8_822/lib C:/Perl_5_8_8_822/site/lib C:/Perl_5_8_8_822/site/lib C:/Perl_5_8_8_822/lib .) at ...

Does anyone know why the use lib ... would work but PERL5LIB wouldn't?

Thanks.


In reply to PERL5LIB mystery by jalucas

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.