Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Paths for PERL5LIB, the -I switch and 'use lib'

by throop (Chaplain)
on Sep 16, 2007 at 04:28 UTC ( [id://639222]=perlquestion: print w/replies, xml ) Need Help??

throop has asked for the wisdom of the Perl Monks concerning the following question:

Brethern

I'm installing CPAN modules on a Solaris system where I don't have admin privileges. So I'm installing in my own directory:

% perl Makefile.pl PREFIX=/home/throop/perl
This causes the code to actually be installed in /home/throop/perl/lib/perl5/site_perl/5.8.5/sun4-solaris I have the impression that perl has enough sense to delve some of the way down this directory path—perlrun says
Any architecture-specific directories under the specified locations are automatically included if they exist.
But what should I put in my path?
  • /home/throop/perl/
  • /home/throop/perl/lib
  • /home/throop/perl/lib/perl5/site_perl/5.8.5
Will the final '/' on the path make a difference? Is the answer the same when I'm spec'ing the path via
  • the PERL5LIB env variable,
  • an -I switch invoking Perl on the command line,
  • a use lib in the script?
Is the answer the same for all?

Finally, if I get the path right at the start (by any of these invocations) will it get passed correctly down to all the subsidiary modules that are invoked using use, do and require?

thanks
throop

Replies are listed 'Best First'.
Re: Paths for PERL5LIB, the -I switch and 'use lib'
by erroneousBollock (Curate) on Sep 16, 2007 at 04:34 UTC
    Zaxo wrote an excellent node to deal with this subject: Personal library with CPAN.

    Once you have PERL5LIB set in your environment, you shouldn't need the -I switch or use lib pragmas.

    -David

      This is only true until you use the taint mode - then PERL5LIB will be ignored.
        This was very helpful. For my original question, a rejoinder surely could have been "Why don't you just try it and see how it works out?" I did that - I grabbed a test program that I'd built and started modifying it, playing with it, calling it with different args. But the results I was getting made no sense - the paths I put in PERL5LIB weren't showing up in INC. So eventually I just asked a question.

        Yes, the test program I grabbed used taint.

        wisdom is slowly dawning
        throop

      Still need use lib pragmas for cgi files, yes?
Re: Paths for PERL5LIB, the -I switch and 'use lib'
by tinita (Parson) on Sep 16, 2007 at 15:27 UTC
    % perl Makefile.pl PREFIX=/home/throop/perl
    try
    % perl Makefile.pl PREFIX=/home/throop/perl LIB=/home/throop/perl
    instead

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-19 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found