Installing Perl modules in $HOME

Introduction

This page describes how Alexis Huxley installed Perl modules in a sub-directory of his $HOME. It also records what modules he installed and why.

Procedure

  1. Run the following commands:
    #  get the cpan command itself configured
    yes "" | head -20 | cpan
    #  where to install modules
    MODROOT=$HOME/opt/$(osid)/perl
    #  get new CPAN
    echo -e "o conf makepl_arg INSTALL_BASE=$MODROOT\ninstall CPAN\nreload cpan" | cpan

    (This should just be done every time; it is easier than working out of it has or has not already been run for a particular value of $(osid).)

  2. To install modules run:
    # Term::ReadKey calls cc and ignores $CC and $GCC
    su - root -c "update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-4.3 1"
    cpan
    # improve CPAN experience
    install Term::ReadKey
    # required for URI::ParseSearchString though latter only warns if YAML missing
    install YAML
    # web-hits script needs this
    install URI::ParseSearchString
    quit
    # Back out cc symlink
    su - root -c "update-alternatives --remove-all cc"
    # Only needed once but few steps in this procedure this way
    matrix

See also