Hi,

I came into this weird issue about finding Perl modules. The problem happens in a script written by others.

A Perl module called SWIG**.pm in put under /some/path/perl/5.8.0/x86_64-linux-thread-multi, and before "use" this module,

use lib "/some/path/perl"

is added. I'm surprised to know Perl will "recursively" add sub directories into @INC if they have some particular names. In this case, "/some/path/perl", "/some/path/perl/5.8.0" and "/some/path/perl/5.8.0/x86_64-linux-thread-multi" will all be added in @INC.

But this is where the issue happens. For some unknown reason, Perl will not add the sub directories into @INC, and the script then report an error: cannot find SWIG**.pm. This issue seems to happen entirely random. I don't when and under what conditions Perl will produce an error like this. The only thing I know is that, when the error happens, both sub directories "/some/path/perl/5.8.0" and "/some/path/perl/5.8.0/x86_64-linux-thread-multi" are missing in the @INC. I want to know if there're any potential reasons that prevent Perl from adding the sub directories into @INC.

Thanks a lot!

-----------------

Update

The dir structure looks like this:

/some/path/perl/5.8.0/x86_64-linux-thread-multi /some/path/perl/5.8.0/x86_64-linux-thread-multi/.lib /some/path/perl/5.8.0/x86_64-linux-thread-multi/auto /some/path/perl/5.8.0/x86_64-linux-thread-multi/auto/SWIG** /some/path/perl/5.8.0/x86_64-linux-thread-multi/SWIG**/libSWIG**.so /some/path/perl/5.8.0/x86_64-linux-thread-multi/SWIG**.pm

All these dirs and files are readable by anyone.

-----------------

Update

Thanks for all of you guys, the problem is now solved. The reason is exactly the one you mentioned, the version of the Perl interpreter. It turns out that, the Perl interpreter on different lsf clusters are different. Even though the shebang of that script is the same, the file that shebang points to is a link, and it links to different Perl interpreters from different lsf cluster's view. I should find someone in the infrastructure department to look at this.

Thank you all, again.


In reply to [SOLVED] Perl randomly couldn't locate a Perl module in @INC by Bravo_t

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.