Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: PERL5LIB different than 'use lib'

by tilly (Archbishop)
on May 07, 2009 at 23:30 UTC ( [id://762718]=note: print w/replies, xml ) Need Help??


in reply to Re^2: PERL5LIB different than 'use lib'
in thread PERL5LIB different than 'use lib'

You'd think they should, but they don't. Try the following:
$ PERL5LIB=/no/such/dir perl -le 'print for @INC' > foo $ PERL5LIB= perl -le 'use lib "/no/such/dir"; print for @INC' > bar $ diff -u foo bar--- foo 2009-05-07 16:24:12.000000000 -0700 +++ bar 2009-05-07 16:24:32.000000000 -0700 @@ -1,12 +1,3 @@ -/no/such/dir/5.8.6/x86_64-linux-thread-multi -/no/such/dir/5.8.6 -/no/such/dir/x86_64-linux-thread-multi -/no/such/dir/5.8.5 -/no/such/dir/5.8.4 -/no/such/dir/5.8.3 -/no/such/dir/5.8.2 -/no/such/dir/5.8.1 -/no/such/dir/5.8.0 /no/such/dir /usr/lib64/perl5/5.8.6/x86_64-linux-thread-multi /usr/lib/perl5/5.8.6
And now we see the difference that saintmike was talking about. If you put stuff in $ENV{PERL5LIB}, it adds a list of internal hardcoded architecture specific directories to look in whether or not those directories exist, and regardless of the contents! By contrast use lib adds subdirectories based on a heuristic about their contents.

Replies are listed 'Best First'.
Re^4: PERL5LIB different than 'use lib'
by almut (Canon) on May 08, 2009 at 09:53 UTC

    This seems to be some (compile-time) configuration option, as none of my perls exhibit that behavior. I've tried with various versions from 5.8.4 to 5.10.0, self-built and/or those that ship with Debian and SUSE Linux. All do produce identical results for PERL5LIB and use lib (both existing and non-existing dirs).

    As you're getting directories for all kinds of versions, I guess it's the configure option that's scanning for other installations of Perl... (which I never use, as I explicitly do want to keep my versions separate).

      That seems likely. I produced those results on a Red Hat box that someone else administers, so I have no idea how that Perl was built. Still if it happened on that machine, it could easily happen for someone else.
        ...it could easily happen for someone else.

        I never doubted that (nor that saintmike might not be telling the truth) — which is why I would've been interested in seeing his strace output... (as I initially suggested).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found