### Local (non-root) install of Perl module from CPAN

To install modules from CPAN with CPAN.pm interface you need to setup a CPAN
configuration file in your home directory.  The CPAN.pm will walk you through
setting up the most important configuration values.  Unfortunately, there is
some variation in the behavior of the various versions of CPAN.pm that have
shipped with Perl.  Some (most) of these variants will not correctly create a
configuration files that allows a non-root user to install modules outside of
"system" paths.  In order to make sure that you get a "correct" CPAN
configuration file you need to "prime" it with a few values.

First you need to create the directory in which the CPAN configuration file will live.
--
mkdir -p .cpan/CPAN/
--

Then we need to create a partial configuration file.  Note that this example
assumes that you want to install your perl modules under
$HOME/jhroot/i686-pc-linux-gnu/lib/perl5.
--
echo "\$CPAN::Config = {" >> .cpan/CPAN/MyConfig.pm
echo "  makepl_arg => q[PREFIX=$HOME/jhroot/i686-pc-linux-gnu]," >> .cpan/CPAN/MyConfig.pm
echo "  mbuildpl_arg => q[--install_base $HOME/jhroot/i686-pc-linux-gnu]," >> .cpan/CPAN/MyConfig.pm
echo "};" >> .cpan/CPAN/MyConfig.pm
echo "1;" >> .cpan/CPAN/MyConfig.pm
echo "__END__" >> .cpan/CPAN/MyConfig.pm
--


Now you need to invoke CPAN.pm so it can walk you through configuring the rest of the required values.  This is an example of one possible configuration with CPAN.com version 1.8802.  *Your version of CPAN.pm may present you with different prompts.*
--
perl -MCPAN -e shell
CPAN: File::HomeDir loaded ok
Sorry, we have to rerun the configuration dialog for CPAN.pm due to
the following indispensable but missing parameters:

build_cache, build_dir, cache_metadata, cpan_home, ftp_proxy, http_proxy, index_expire, inhibit_startup_message, keep_source_where, make_arg, make_install_arg, mbuild_arg, mbuild_install_arg, mbuild_install_build_command, no_proxy, prerequisites_policy, scan_cache, urllist


The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.



I see you already have a  directory
    /home/moanui/jhoblitt/.cpan
Shall we use it as the general CPAN build and cache directory?

CPAN build and cache directory? [/home/moanui/jhoblitt/.cpan]


Unless you are accessing the CPAN via the filesystem directly CPAN.pm
needs to keep the source files it downloads somewhere. Please supply a
directory where the downloaded files are to be kept. [/home/moanui/jhoblitt/.cpan/sources]
Directory where the build process takes place? [/home/moanui/jhoblitt/.cpan/build]


How big should the disk cache be for keeping the build directories
with all the intermediate files?

Cache size for build directory (in MB)? [100]


The CPAN indexes are usually rebuilt once or twice per hour, but the
typical CPAN mirror mirrors only once or twice per day. Depending on
the quality of your mirror and your desire to be on the bleeding edge,
you may want to set the following value to more or less than one day
(which is the default). It determines after how many days CPAN.pm
downloads new indexes.

Let the index expire after how many days? [1]


By default, each time the CPAN module is started, cache scanning is
performed to keep the cache size in sync. To prevent this, answer
'never'.

Perform cache scanning (atstart or never)? [atstart]


To considerably speed up the initial CPAN shell startup, it is
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.

Cache metadata (yes/no)? [yes]


The CPAN module can detect when a module which you are trying to build
depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.

Policy on building prerequisites (follow, ask or ignore)? [ask] follow


Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in separate processes. If you have
any parameters (e.g. PREFIX, LIB, UNINST or the like) you want to
pass to the calls, please specify them here.

If you don't understand this question, just press ENTER.
Parameters for the 'make' command?
Typical frequently used setting:

    -j3              # dual processor system

Your choice:  []
Parameters for the 'make install' command?
Typical frequently used setting:

    UNINST=1         # to always uninstall potentially conflicting files

Your choice:  [] UNINST=1


The next questions deal with Module::Build support.

A Build.PL is run by perl in a separate process. Likewise we run
'./Build' and './Build install' in separate processes. If you have any
parameters you want to pass to the calls, please specify them here.

Parameters for the './Build' command?
Setting might be:

    --extra_linker_flags -L/usr/foo/lib  # non-standard library location

Your choice:  []
Do you want to use a different command for './Build install'?
Sudo users will probably prefer:

    su root -c ./Build
or
    sudo ./Build
or
    /path1/to/sudo -u admin_account ./Build

or some such. Your choice:  [./Build]
Parameters for the './Build install' command?
Typical frequently used setting:

    --uninst 1                           # uninstall conflicting files

Your choice:  [] --uninst 1


If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

Your ftp_proxy? []
Your http_proxy? []
Your no_proxy? []
You have no /home/moanui/jhoblitt/.cpan/sources/MIRRORED.BY
  I'm trying to fetch one
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  http://www.perl.org/CPAN/MIRRORED.BY


Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.

First, pick a nearby continent and country by typing in the number(s)
in front of the item(s) you want to select. You can pick several of
each, separated by spaces. Then, you will be presented with a list of
URLs of CPAN mirrors in the countries you selected, along with
previously selected URLs. Select some of those URLs, or just keep the
old list. Finally, you will be prompted for any extra URLs -- file:,
ftp:, or http: -- that host a CPAN mirror.

(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 5

(1) Bahamas
(2) Canada
(3) Mexico
(4) United States
Select your country (or several nearby countries) [] 4

(1) ftp://carroll.cac.psu.edu/pub/CPAN/
(2) ftp://cpan-du.viaverio.com/pub/CPAN/
(3) ftp://cpan-sj.viaverio.com/pub/CPAN/
(4) ftp://cpan.calvin.edu/pub/CPAN
(5) ftp://cpan.cs.utah.edu/pub/CPAN/
(6) ftp://cpan.cse.msu.edu/
(7) ftp://cpan.erlbaum.net/CPAN/
(8) ftp://cpan.glines.org/pub/CPAN/
(9) ftp://cpan.hostrack.net/pub/CPAN
(10) ftp://cpan.llarian.net/pub/CPAN/
(11) ftp://cpan.mirrors.redwire.net/pub/CPAN/
(12) ftp://cpan.mirrors.tds.net/pub/CPAN
(13) ftp://cpan.netnitco.net/pub/mirrors/CPAN/
(14) ftp://cpan.pair.com/pub/CPAN/
(15) ftp://cpan.teleglobe.net/pub/CPAN
(16) ftp://cpan.uchicago.edu/pub/CPAN/
40 more items, hit RETURN to show them
Select as many URLs as you like (by number),
put them on one line, separated by blanks, hyphenated ranges allowed
 e.g. '1 4 5' or '7 1-4 8' [] 14 11 12

Enter another URL or RETURN to quit: []
New set of picks:
  ftp://cpan.pair.com/pub/CPAN/
  ftp://cpan.mirrors.redwire.net/pub/CPAN/
  ftp://cpan.mirrors.tds.net/pub/CPAN


Please remember to call 'o conf commit' to make the config permanent!


cpan shell -- CPAN exploration and modules installation (v1.8802)
ReadLine support enabled

 cpan[1]> o conf commit
commit: wrote '/home/moanui/jhoblitt/.cpan/CPAN/MyConfig.pm'
--


Now we should install the basic compliment of helper modules that CPAN.pm needs to function fully.
--
install Bundle::CPAN
--

You can quit out of the CPAN shell at this point with the `exit` command or do the following few steps in another shell


We're ready to install the full set Perl module dependencies for IPP software.  In order to make this process a bit easier on the end user a "Bundle" module has been created.  In order to use it you need to create a directory (if it doesn't already exist) called Bundle under your .cpan directory.

--
mkdir -p .cpan/Bundle
--

The file PS.pm should copied into this directory.

--
cp ~foo/PS.pm .cpan/Bundle/
--

Enter back into the CPAN shell and 'force' the install of the PS Bundle.  The
'force' keyword instructs the shell to ignore any tests failures.  This is
necessary as some of the modules 'DBD::mysql'/etc. require a properly working
database setup in order for the tests to pass.  You will most likely be
prompted for input by several the modules.  It is safe to answer with a
carriage return to all questions.
--
perl -MCPAN -e shell
force install Bundle:PS
--


In order to use another of these modules that were just installed when need to
setup an environment variable called PERL5LIB so that 'perl' can find them.
To do this, we need to know where under 'perl5' our modules were actually
installed.  This will variable with the version of Perl that you are using.
The easiest way to do this is just just look in the root of the path where we
did the install.

--
`ls jhroot/i686-pc-linux-gnu/lib/perl5/`
--

Which should show something like:

5.8.8  Test  site_perl

That means were using perl 5.8.8 and PERL5LIB needs to be setup as following:
--
export PERL5LIB=$HOME/jhroot/i686-pc-linux-gnu/lib/perl5/5.8.8:$HOME/jhroot/i686-pc-linux-gnu/lib/perl5/site_perl/5.8.8
--

For instructions on installing Perl modules from CPAN ''by hand', see:

    http://www.cs.ucsc.edu/~you/notes/perl-module-install.html

