johannz has asked for the wisdom of the Perl Monks concerning the following question:

I have just recently gotten a shell account at IO.com. The nice thing about this is that I can finally have a non-work related place to play with some of my CGI coding.

They have perl 5.005_02 with the standard distro. This includes CPAN.pm. I like CPAN.pm and tend to use it as much as possible to install modules since it notifies me of dependancy issues, etc. In preparing to use it last night, I was reviewing the documentation on how to use it with a NON-root account. It talked about global settings in the CPAN/Config.pm module and how these could be over-ridden in a ~/.cpan/CPAN/MyConfig.pm file. But there was no example of what a MyConfig.pm file would look like.

So, being the do-it-yourself-er that I am, I attempted to write my own MyConfig.pm file. I tried the following:

use CPAN::Config; $CPAN::Config->{'cpan_home'} = '/home/j/johannz/.cpan'; 1;

After some mucking about and experimenting I finally got things to work. But the MyConfig.pm that CPAN.pm wrote just overrides everything and does not use the global settings file at all it looks like.

$CPAN::Config = { 'build_cache' => q[10], 'build_dir' => q[/home/j/johannz/.cpan/build], 'cpan_home' => q[/home/j/johannz/.cpan], 'ftp' => q[/usr/bin/ftp], 'ftp_proxy' => q[], 'getcwd' => q[cwd], 'gzip' => q[/bin/gzip], 'http_proxy' => q[], 'inactivity_timeout' => q[0], 'index_expire' => q[1], 'inhibit_startup_message' => q[0], 'keep_source_where' => q[/home/j/johannz/.cpan/sources], 'lynx' => q[/usr/local/bin/lynx], 'make' => q[/usr/bin/make], 'make_arg' => q[], 'make_install_arg' => q[], 'makepl_arg' => q[], 'ncftp' => q[/usr/bin/ncftp], 'no_proxy' => q[], 'pager' => q[/usr/bin/less], 'shell' => q[/usr/local/bin/tcsh], 'tar' => q[/bin/tar], 'unzip' => q[/usr/bin/unzip], 'urllist' => [q[ftp://cpan.nas.nasa.gov/pub/perl/CPAN/], q[ftp://ftp.cpan.org/CPAN/], q[ftp://ftp.perl.org/pub/perl/CPAN/], q[ftp://ftp.sunsite.utk.edu/pub/CPAN/]], 'wait_list' => [q[wait://ls6.informatik.uni-dortmund.de:1404]], }; 1;

So, is it possible to make this file really inherit the global settings and only override the settings I need to customize?
Anyone else have experience installing and configuring modules on a box where you are not root?

Replies are listed 'Best First'.
Re: User-level configuration of CPAN.pm
by chromatic (Archbishop) on Oct 18, 2000 at 23:18 UTC
    Based on a little experimenting with a normal user account on my box, it looks like CPAN loads either the global configuration file or the local one.

    I suggest copying CPAN::Config to your local directory (~/.cpan/CPAN), modifying what you want to modify, then running CPAN interactively.

    I removed everything but the build directory from MyConfig.pm, and it prompted me to fill in the rest of the values. The defaults were pretty sane, though.

Re: User-level configuration of CPAN.pm
by merlyn (Sage) on Oct 19, 2000 at 08:28 UTC
    It's actually rather simple.
    perl -MCPAN::FirstTime -eCPAN::FirstTime::init
    Then answer all the questions. You'll be totally debundled from the system installation that way. Be sure you answer the Makefile.PL option with the right PREFIX=$HOME/whatever value, as described in perlman:perlmodinstall.

    -- Randal L. Schwartz, Perl hacker

      Thank you merlyn. Just curious, where is this documented? I went though all kinds of documentation trying to find this and never found anything. So is just one of the secrets of the Perl Masters that we aren't supposed to talk about in public? :-)