in reply to Re^2: use lib current directory
in thread use lib current directory

If adding use lib "."; fixes a problem && "." is included in @INC, then my first thought is that something removes "." from @INC.

I would think that this removal would have happened inside the perl code, and at compile time - eg inside a BEGIN{} block.
So that would be the fist place to look.

If you have a script in which you have included use lib ".";, try inserting immediately *before* that line:
BEGIN {print "$_\n" for @INC;};
If that shows you that "." was present during the execution of the BEGIN{} block, then the inclusion of use lib "."; would do nothing more than put "." at the *beginning* of @INC. That is, instead of having "." last in the @INC search path, it is now *first*.
Could that be the key to the success with use lib "."; in your case ?

(There are perhaps other scenarios that I've overlooked.)

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: use lib current directory
by Anonymous Monk on Feb 25, 2014 at 11:23 UTC
    taint mode removes . from @INC ... relying on . is like relying on pwd , its unreliable
Re^4: use lib current directory
by viradan (Novice) on Feb 25, 2014 at 14:10 UTC
    hi rob,
    yes, use lib "."; moves the "." to the top - then it works ok
    still doesn't explain why new OS requires moving "." to the top
    1-/local/tmp/test/perlModules/x86_64-linux-thread-multi 1-/local/tmp/test/perlModules 1-/usr/local/lib64/perl5 1-/usr/local/share/perl5 1-/usr/lib64/perl5/vendor_perl 1-/usr/share/perl5/vendor_perl 1-/usr/lib64/perl5 1-/usr/share/perl5 1-.
    with use lib ".";
    2-. 2-/local/tmp/test/perlModules/x86_64-linux-thread-multi 2-/local/tmp/test/perlModules 2-/usr/local/lib64/perl5 2-/usr/local/share/perl5 2-/usr/lib64/perl5/vendor_perl 2-/usr/share/perl5/vendor_perl 2-/usr/lib64/perl5 2-/usr/share/perl5
    cheers,
    dan
      doesn't explain why new OS requires moving "." to the top

      I doubt that it's a requirement of the OS.
      If you have a module named FOO.pm in "." and also in (say) /usr/share/perl5, and your code contains use FOO; then, in the first instance, it's the FOO.pm from /usr/share/perl5 that gets loaded. But in the second instance it's the FOO.pm from "." that gets loaded.
      This happens because use FOO; tells perl to search through @INC from beginning to end, and load the first module named FOO.pm that it finds.

      So ... if there's some problem with the FOO.pm that's in /usr/share/perl5 but the one in "." is ok, then it makes a big difference whether "." is searched before or after /usr/share/perl5.

      I don't think you've told us the actual error you get if you don't use lib ".";
      What is that error message ?

      Cheers,
      Rob
        hi Rob,
        arrggh! you're right, in one of INC paths latest OS contains newly module with the same name as mine in "."
        many thanks, the world is saved again :)
        dan