Bravo_t has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl randomly couldn't locate a Perl module in @INC
by Athanasius (Archbishop) on Jul 23, 2015 at 07:06 UTC | |
by Bravo_t (Acolyte) on Jul 23, 2015 at 08:06 UTC | |
|
Re: Perl randomly couldn't locate a Perl module in @INC
by Corion (Patriarch) on Jul 23, 2015 at 07:08 UTC | |
by Bravo_t (Acolyte) on Jul 23, 2015 at 07:57 UTC | |
|
Re: Perl randomly couldn't locate a Perl module in @INC
by MidLifeXis (Monsignor) on Jul 23, 2015 at 12:51 UTC | |
by Bravo_t (Acolyte) on Jul 24, 2015 at 01:54 UTC |