Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: use lib current directory

by syphilis (Archbishop)
on Feb 25, 2014 at 22:54 UTC ( [id://1076203]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^6: use lib current directory
by viradan (Novice) on Feb 26, 2014 at 07:07 UTC
    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1076203]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-16 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found