Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: Including files

by Juerd (Abbot)
on Dec 09, 2011 at 11:46 UTC ( #942623=note: print w/replies, xml ) Need Help??

in reply to Re: Including files
in thread Including files

If the module you're including is actually in the current directory, no use lib is required at all, since the current working directory, also known as ".", is already in @INC by default.

Replies are listed 'Best First'.
Re^3: Including files
by chacham (Prior) on Dec 09, 2011 at 13:24 UTC
    Let me get this straight:
    • ~/abc/
    • ~/abc/
    • ~/zyx/
    • current directory is ~/zyx has:

    • use cow
    • use lib 'cow'

    When i execute, . is set to ~/zyx, so:

    • use cow means ~/zyx/
    • use lib 'cow' means ~/abc/

    Did i get it right that, basically, there is a difference between the "current" directory and the directory of the pl file. Or, put another way, if i keep all my project files in the same directory, like we do during development, and the directory may change, and the directory i execute it from may change, "use lib" will work "as expected".

      Did i get it right that

      No. Read lib. use lib 'cow'; is the standard, clean alternative to unshift @INC, 'cow'; It adds a directory to the search locations; it does not identify or pull in any files into the current program.

      if i keep all my project files in the same directory, ... "use lib" will work "as expected".

      No; if you do that, then you never need use lib ... at all, for the simple reason that '.' is in @INC by default.

      I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
        Please give an example. I would like to get this clear.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942623]
[hippo]: How are you doing the match? Regex, index, eq or something else?
[choroba]: fc $s1 eq fc $s2 I guess
[Tanktalus]: hippo: I don't care, I just want to prove it can match correctly compared to, say, ILIKE / UPPER / LOWER in postgres :)
[LanX]: is there a unicode convention that ß is ss ?
[Tanktalus]: LanX: yes :) I haven't tried java, but I have this match working in its bastard cousin, C# :) I just thought perl's unicode support would get me there :)
[LanX]: I have my doubts, IMHO its a workaround if the glyph is missing
[LanX]: (they are pronounced differently)
[choroba]: perl -Mutf8 -Mfeature=fc -wE 'say fc "straße" eq fc "strasse"'
[choroba]: returns 1 for me
[choroba]: are they?

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (13)
As of 2018-03-21 15:42 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (268 votes). Check out past polls.