in reply to Set Install path in CPAN

When the CPAN shell starts, if it finds a file called ~/.cpan/CPAN/MyConfig.pm it will use that as the configuration file instead of the default one root has in its home directory.

So, run:

$ mkdir -p ~/.cpan/CPAN

and then run:

$ cp /root/.cpan/CPAN/Config.pm ~/.cpan/CPAN/MyConfig.pm

or even just:

$ touch ~/.cpan/CPAN/MyConfig.pm

Now, when you run:

$ perl -MCPAN -e shell

At the cpan prompt tell it to initialize the configuration:

cpan> o conf init

CPAN will go through its initialization process, and ask you a bunch of questions (including what to set as arguments to Makefile.PL, which tells make install where to put the files. When it is done, you can use the cpan shell to install modules in a user defined location.

Note that when installing libraries that have dependencies that are installed in your local directory, perl needs to be able to find them. So what I do is set PERL5LIB when I run cpan:

$ PERL5LIB=~/perl/lib perl -MCPAN -e shell

Enjoy,

trwww

Replies are listed 'Best First'.
Re^2: Set Install path in CPAN
by compused (Acolyte) on Feb 14, 2012 at 06:58 UTC
    Monks, can you help again?

    I have done what trwww suggests immediately above, but this has not moved MyConfig from out of /root; it still shows as follows:

    cpan[1]> o conf $CPAN::Config options from /root/.cpan/CPAN/MyConfig.pm: etc etc

    I want to move /MyConfig file out of /root as anything on root is on a RAM drive (its a qnap NAS device

    Here is my full config:

    cpan[1]> o conf $CPAN::Config options from /root/.cpan/CPAN/MyConfig.pm: commit [Commit changes to disk] defaults [Reload defaults from disk] help [Short help about 'o conf' usage] init [Interactive setting of all options] applypatch [] auto_commit [1] build_cache [100] build_dir [/share/MD0_DATA/.cpan/build_dir] build_dir_reuse [1] build_requires_install_policy [yes] bzip2 [/opt/bin/bzip2] cache_metadata [1] check_sigs [0] colorize_debug undef colorize_output [0] colorize_print undef colorize_warn undef commandnumber_in_prompt [1] commands_quote undef connect_to_internet_ok [1] cpan_home [/share/MD0_DATA/.cpan] curl undef dontload_hash undef dontload_list undef ftp undef ftp_passive [1] ftp_proxy [] ftpstats_period undef ftpstats_size undef getcwd [cwd] gpg [/opt/bin/gpg2] gzip [/bin/gzip] halt_on_failure [0] histfile [/share/MD0_DATA/.cpan/histfile] histsize [100] http_proxy [] inactivity_timeout [0] index_expire [1] inhibit_startup_message [0] keep_source_where [/share/MD0_DATA/.cpan/sources] load_module_verbosity [none] lynx undef make [/share/MD0_DATA/.qpkg/Optware/bin/make] make_arg [] make_install_arg [] make_install_make_command [/opt/bin/make] makepl_arg [PREFIX=/share/MD0_DATA] mbuild_arg [] mbuild_install_arg [] mbuild_install_build_command [./Build] mbuildpl_arg [] ncftp undef ncftpget undef no_proxy [] pager [/bin/more] password undef patch [/opt/bin/patch] patches_dir undef perl5lib_verbosity [none] prefer_external_tar [1] prefer_installer [MB] prefs_dir [/share/MD0_DATA/.cpan/prefs] prerequisites_policy [follow] proxy_pass undef proxy_user undef randomize_urllist undef scan_cache [atstart] shell [/bin/sh] show_unparsable_versions [0] show_upload_date [0] show_zero_versions [0] tar [/opt/bin/tar] tar_verbosity [none] term_is_latin [1] term_ornaments [1] test_report [0] trust_test_report_history [0] unzip [/usr/bin/unzip] urllist 0 [http://cpan.mirrors.ilisys.com.au/] 1 [http://mirror.internode.on.net/pub/cpan/] 2 [http://cpan.mirror.aussiehq.net.au/] use_sqlite [0] username undef version_timeout [15] wait_list undef wget [/usr/bin/wget] yaml_load_code [0] yaml_module [YAML]

        Thanks Anonymous !