Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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{''}."<<<< 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 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/
        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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2014-09-22 13:37 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (192 votes), past polls