Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Set Install path in CPAN

by rose (Beadle)
on Aug 01, 2007 at 11:50 UTC ( [id://630026]=perlquestion: print w/replies, xml ) Need Help??

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

We are using cpan command in unix environment to install the perl modules.

cpan> install HTML::Template

This modules will install in @INC path.

I want to install HTML::Template module in my personal directory ie. /proj/rose/.

Is there any way to set installation path?

Thanks in Advance!!

Replies are listed 'Best First'.
Re: Set Install path in CPAN
by lima1 (Curate) on Aug 01, 2007 at 11:58 UTC
    cpan> o conf mbuildpl_arg "--install_base /proj/rose/" cpan> o conf makepl_arg "PREFIX=/proj/rose/" cpan> install HTML::Template
      After setting the conf options, i used o conf commit. Can you please tell how to reset/rollback it

        Either set the options back manually and then use o conf commit again, or reinitialize CPAN:

        o conf init
Re: Set Install path in CPAN
by trwww (Priest) on Aug 01, 2007 at 13:57 UTC

    When the CPAN shell starts, if it finds a file called ~/.cpan/CPAN/ 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/ ~/.cpan/CPAN/

    or even just:

    $ touch ~/.cpan/CPAN/

    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



      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/ 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/ 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 [] 1 [] 2 [] use_sqlite [0] username undef version_timeout [15] wait_list undef wget [/usr/bin/wget] yaml_load_code [0] yaml_module [YAML]
Re: Set Install path in CPAN
by gube (Parson) on Aug 01, 2007 at 12:13 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://630026]
Approved by lima1
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-14 17:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found