Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Overriding default libs

by xajin24 (Initiate)
on Nov 15, 2012 at 13:20 UTC ( #1004009=perlquestion: print w/ replies, xml ) Need Help??
xajin24 has asked for the wisdom of the Perl Monks concerning the following question:

Hi perlmonks community, I do not have permissions to install modules on my machine so I am looking for a round-about way of doing it. Currently I downloaded the desired module from CPAN and installed it in a local directory. The current machine I am working on is running perl 5.8.8 and has the 1.07 version of threads and I need it to be 1.6+. I've tried  use lib /path/ as well as  BEGIN{} to try to force my perl script to use the lib I need. The problem is that whenever I try to force the use of my lib, it is still referring to the default one in /usr/lib64/perl5/5.8.8/...

!/usr/bin/perl use lib "/tmp/custom_module/"; use warnings; use threads; print $INC{'threads.pm'}."<<<< Source of threads\n";

Comment on Overriding default libs
Select or Download Code
Re: Overriding default libs
by tobyink (Abbot) on Nov 15, 2012 at 13:30 UTC

    Are you sure threads.pm is in "/tmp/custom_module"? Or is it in a subdirectory like "/tmp/custom_module/lib"?

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      The exact path of the .pm file is: /tmp/custom_module/lib/perl5/x86_64-linux-thread-multi/threads.pm
        use lib '/tmp/custom_module/lib/perl5/x86_64-linux-thread-multi/';

        Then you should use lib "/tmp/custom_module/lib/perl5";. (Perl should be able to guess the "x86_64-linux-thread-multi" bit.)

        perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: Overriding default libs
by Anonymous Monk on Nov 15, 2012 at 14:12 UTC
    Search for "installing Perl as a non-root user." Your situation is identical to the one that is faced e.g. by installing a Perl-based web site on a shared host.
Re: Overriding default libs
by space_monk (Chaplain) on Nov 15, 2012 at 14:23 UTC
    There are lots of nodes on this, including:

    Basically, setting a local version of PERL5LIB is a good way of ensuring that your libraries are used first or exclusively.

    A Monk aims to give answers to those who have none, and to learn from those who know more.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (18)
As of 2014-07-23 14:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (144 votes), past polls