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

I fail when trying to use CPAN to install into my home directory. The modules attempt to install into directories for which I don't have permission. (I see this failure on many modules that I've tried.)

I expect I've got something wrong in o conf, but I can't figure what.

I have variables set as:

$ perl -MCPAN -e shell cpan[1]> o conf ... makepl_arg [INSTALLMAN3DIR=/home/dthroop/lib/perl/man/man3 +] mbuild_arg [INSTALLMAN3DIR=/home/dthroop/lib/perl/man/man3 +] mbuild_install_arg [INSTALLMAN3DIR=/home/dthroop/lib/perl/man/man3 +] mbuildpl_arg [--lib=/home/dthroop/lib/perl --installman1dir= +/home/dthroop/lib/perl/man/man1 --installman3dir=/home/dthroop/lib/pe +rl/man/man3 --installscript=/home/dthroop/lib/perl/bin --installbin=/ +home/dthroop/lib/perl/bin] ...
Or to show you all the switches
cpan[8]> o conf $CPAN::Config options from /home/dthroop/.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 [0] build_cache [100] build_dir [/home/dthroop/.cpan/build] build_dir_reuse [1] build_requires_install_policy [yes] bzip2 [/usr/bin/bzip2] cache_metadata [1] check_sigs [0] colorize_debug [black on_cyan] colorize_output [1] colorize_print [bold blue on_white] colorize_warn [bold red on_white] commandnumber_in_prompt [1] commands_quote undef connect_to_internet_ok [1] cpan_home [/home/dthroop/.cpan] curl [/usr/bin/curl] dontload_hash undef dontload_list undef ftp [/usr/bin/ftp] ftp_passive [0] ftp_proxy [] ftpstats_period undef ftpstats_size undef getcwd [cwd] gpg [/usr/bin/gpg] gzip [/bin/gzip] halt_on_failure [0] histfile [/home/dthroop/.cpan/histfile] histsize [100] http_proxy [] inactivity_timeout [0] index_expire [1] inhibit_startup_message [0] keep_source_where [/home/dthroop/.cpan/sources] load_module_verbosity [none] lynx undef make [/usr/bin/make] make_arg [-j3] make_install_arg [-j3] make_install_make_command [/usr/bin/make] makepl_arg [INSTALLMAN3DIR=/home/dthroop/lib/perl/man/man3 +] mbuild_arg [INSTALLMAN3DIR=/home/dthroop/lib/perl/man/man3 +] mbuild_install_arg [INSTALLMAN3DIR=/home/dthroop/lib/perl/man/man3 +] mbuild_install_build_command [./Build] mbuildpl_arg [--lib=/home/dthroop/lib/perl --installman1dir=/h +ome/dthroop/lib/perl/man/man1 --installman3dir=/home/dthroop/lib/perl +/man/man3 --installscript=/home/dthroop/lib/perl/bin --installbin=/ho +me/dthroop/lib/perl/bin] ncftp [] ncftpget [/usr/bin/ncftpget] no_proxy [] pager [/usr/bin/less] password undef patch [/usr/bin/patch] patches_dir undef perl5lib_verbosity [none] prefer_external_tar [1] prefer_installer [MB] prefs_dir [/home/dthroop/.cpan/prefs] prerequisites_policy [follow] proxy_pass undef proxy_user undef randomize_urllist undef scan_cache [atstart] shell [/bin/tcsh] show_unparsable_versions [0] show_upload_date [0] show_zero_versions [0] tar [/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.dagolden.com/] 1 [http://mirror.sit.wisc.edu/pub/CPAN/] 2 [http://www.perl.com/CPAN/] 3 [http://mirror.uoregon.edu/CPAN/] 4 [http://mirror.datapipe.net/CPAN/] 5 [http://cpan.cs.utah.edu/] use_sqlite [1] username undef version_timeout [15] wait_list undef wget [/usr/bin/wget] yaml_load_code [1] yaml_module [YAML]
But when I try
cpan[1]> install Data::Table ... Running make install Appending installation info to /usr/lib/perl5/perllocal.pod /bin/sh: /usr/lib/perl5/perllocal.pod: Permission denied make: [doc_site_install] Error 1 (ignored) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! ERROR: Can't create '/usr/local/share/man/man3' Do not have write permissions on '/usr/local/share/man/man3' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! at -e line 1 make: *** [pure_site_install] Error 13 EZDB/Data-Table-1.60.tar.gz /usr/bin/make install -j3 -- NOT OK
Site policy says I can't have permanent permission to /usr/local/share/man/man3. But even when my sysadmin gives me temporary permission, I get
cpan[6]> force install Data::Table ... Running make install Appending installation info to /usr/lib/perl5/perllocal.pod /bin/sh: /usr/lib/perl5/perllocal.pod: Permission denied make: [doc_site_install] Error 1 (ignored) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! ERROR: Can't create '/usr/local/share/perl5/Data' mkdir /usr/local/share/perl5/Data: Permission denied at /usr/share/per +l5/ExtUtils/Install.pm line 494
What am I doing wrong?

Replies are listed 'Best First'.
Re: CPAN won't install into personal directory; probably an o conf problem
by zentara (Cardinal) on Apr 25, 2012 at 18:24 UTC
    What am I doing wrong?

    You are not using local::lib :-) It's as easy as this:

    How to use the local::lib module: Use the --bootstrap method to install local::lib according to its inst +allation instructions and then echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc then run cpan shell this way perl -MCPAN -Mlocal::lib -e shell you may need to cpan> reload cpan cpan> o conf init connect_to_internet_ok urllist cpan> install Crypt::Rijndael # for example

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Thanks! that worked wonderfully.

      BTW, something I found only through trial and error: I downloaded and untarred local::lib, and connected to the directory it created ( local-lib-1.008004). I created the makefile:

      perl Makefile.PL --bootstrap=/home/dthroop
      and followed the directions.

      When all was said and done, this resulted in

      $ cpan > install Data::Table
      placing its code in
      /home/dthroop/perl5/lib/perl5/Data/Table.pm
Re: CPAN won't install into personal directory; probably an o conf problem
by Anonymous Monk on Apr 26, 2012 at 03:51 UTC
Re: CPAN won't install into personal directory; probably an o conf problem
by Anonymous Monk on Dec 25, 2018 at 08:36 UTC
    Add sudo before running make install

      This advice is wrong, OP wanted to install to their home directory. local::lib etc.

      Can you please explain how sudo is part of the solution if you're installing into a personal directory ?

      sudo is for using super user permissions, and installing into a personal directory is used to install CPAN modules without requiring super user permissions.