Very often in a centrally administered organization you don’t have root access and have the possibility to install Perl modules in the ordinary system wide directory structure, here is how to build and install them locally in your own location:

% perl Makefile.PL PREFIX=<path to your local storage>

or alternatively

% perl Makefile.PL INSTALL_BASE=<path to your local storage>

% make

% make test

% make install

% make clean

To use this module later on, you can either add a:

use lib '<path to your local storage>'; 

directive in your perl scripts, or you can set some system variables:

See also: How do I add a directory to my include path (@INC) at runtime?


# syntax for sh, bash, ksh, or zsh
$ export PERLLIB=$HOME/perllib

# syntax for sh, bash, ksh, or zsh
$ export PERL5LIB=$HOME/perllib

# syntax for csh or tcsh
% setenv PERL5LIB ~/perllib

Here is what Module Build Coockbook has to say about the two alternatives (PREFIX vs. INSTALL_BASE):

prefix vs install_base

The behavior of prefix is complicated and depends on how your Perl is configured. The resulting installation locations will vary from machine to machine and even different installations of Perl on the same machine. Because of this, it’s difficult to document where prefix will place your modules.

In contrast, install_base has predictable, easy to explain installation locations. Now that Module::Build and MakeMaker both have install_base there is little reason to use prefix other than to preserve your existing installation locations. If you are starting a fresh Perl installation we encourage you to use install_base . If you have an existing installation installed via prefix , consider moving it to an installation structure matching install_base and using that instead.