When working on systems you do not have root access to, you may have the problem that bothering the IT staff for installing every single package is quite annoying for both sides. For python, there is virtualenv which allows you to install a completely different python version into a local directory with user privileges only. For python, this can be done similarly. Here is how:
First, you need a “package manager” for perl. There are plenty, but cpanm will do. Please make sure that the directory ~/perl5 is currently not in use. As long as you have any perl executable at all, this is all you need:
curl -L http://cpanmin.us | perl - App::cpanminus
Now decide on a custom installation path:
PERLDIR='PATH_TO_LOCAL_PERL' mkdir -p "$PERLDIR" cd "$PERLDIR"
This moves the preliminary install to your target folder.
mv ~/perl5/ .
Now add these three lines to your .bashrc and execute them on the command line.
export PERL5LIB="$PERLDIR"/lib export MANPATH="$PERLDIR"/man export PATH="$PERLDIR/bin/:$PATH"
This change is not permanent unless you install a special perl module.
cpanm --local-lib="$PERLDIR" local::lib && eval $(perl -I "$PERLDIR"/lib/perl5/ -Mlocal::lib)
For the local installation being effective in all shells, add the following line to the .bashrc as well.
eval $(perl -I "$PERLDIR"/lib/perl5/ -Mlocal::lib)
Now installing perl modules is easy: