Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Installing Perl modules locally

by ericjp (Initiate)
on Apr 06, 2005 at 19:35 UTC ( #445416=perlquestion: print w/replies, xml ) Need Help??
ericjp has asked for the wisdom of the Perl Monks concerning the following question:

My company has a central server where all Perl libraries are mounted. This is a read-only file system, and they don't permit individuals to install new libraries. However, I am permitted to install libraries locally on my servers. This is what I want to do; however, I am unsure of how to do this properly. I am primarily a Perl coder - I have not done a lot of customizing the Perl environment, and this is the first time that I needed a library that was not on the server. The library I need to install is the Net::NetSend library. I have already downloaded the library from Can I get some advice on installing a library locally when all the others are installed somewhere on a remote file system? I have confirmed that my server has the other libraries I need: POSIX, IO and Socket. Thanks, EricJP

Retitled by BazB from 'Installing Per Libraries with a Twist'.

Replies are listed 'Best First'.
Re: Installing Perl modules locally
by Joost (Canon) on Apr 06, 2005 at 19:56 UTC
      This sounds good. I think this will be the only library that I will need to install, so I won't need to set up my own $HOME. Please forgive my ignorance, but I want to make sure that I install the it properly. The line 'perl Makefile.PL PREFIX=/tmp/myperl5' - can I put a different dir than the one listed? I am assuming so, but I want to make sure.... Also, when this is done I should be able to call the library from my scripts without doing anything more, correct? Thanks again, EricJP
        the prefix specifies the "base directory", so everything that gets installed will get installed relative to that directory. this means that, in this example the modules will go somewhere in "/tmp/myperl5/lib/perl5/site_perl/5.8.6" (depending on your perl version number), manpages will got in "/tmp/myperl5/man/...." etc.

        If you then want to use the libraries need to make sure the perl interpreter knows where to find them: you can set the PERL5LIB environment variable to "/tmp/myperl5/lib/perl5/site_perl/5.8.6" or put use lib '/tmp/myperl5/lib/perl5/site_perl/5.8.6'; in your code.

        And yes, you can basically use any directory you like, though dirs with spaces in their name tend to cause confusion.

        If you want to have more control over which parts of the installation go where, take a look at the ExtUtils::MakeMaker documentation.

Re: Installing Perl modules locally
by tall_man (Parson) on Apr 06, 2005 at 23:00 UTC
    If you find you will need to install many modules, setting up your own $HOME/.cpan/CPAN/ might be worthwhile.

    You will need to touch entries like the following:

    'build_dir' => q[/home/me/.cpan/build], 'cpan_home' => q[/home/me/.cpan], 'keep_source_where' => q[/home/me/.cpan/sources], 'makepl_arg' => q[LIB=/home/me/myperl/lib INSTALLMAN1DIR=/home/me/my +perl/man/man1 INSTALLMAN3DIR=/home/me/myperl/man/man3],

    Once you have done this, you will be able to install modules easily using:

    perl -MCPAN -e shell install Net::NetSend

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://445416]
Approved by SciDude
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-01-22 18:49 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (189 votes). Check out past polls.