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

Dear Masters,
Generally I have no problem in installing a CPAN module in my home directory. But in this particular server I encounter this error.
[myname@somehost ~]$ cpan CPAN: File::HomeDir loaded ok cpan shell -- CPAN exploration and modules installation (v1.87) ReadLine support enabled cpan> install Some::Module CPAN: Storable loaded ok mkdir /tmp/.cpan/sources: Permission denied at /usr/lib/perl5/5.8.8/CP +AN.pm line 2541 Couldn't open >/tmp/.cpan/histfile: Permission denied Couldn't open >/tmp/.cpan/histfile: Permission deniedCouldn't open >/t +mp/.cpan/histfile: Permission denied
Can anybody suggest how to go about this? And my MyConfig.pm looks like this:
# This is CPAN.pm's systemwide configuration file. This file provides # defaults for users, and the values can be changed in a per-user # configuration file. The user-config file is being looked for as # ~/.cpan/CPAN/MyConfig.pm. $CPAN::Config = { 'build_cache' => q[10], 'build_dir' => q[/tmp/.cpan/build], 'bzip2' => q[/usr/bin/bzip2], 'cache_metadata' => q[1], 'cpan_home' => q[/home/myname/.cpan], 'curl' => q[/usr/bin/curl], 'dontload_hash' => { }, 'ftp' => q[/usr/kerberos/bin/ftp], 'ftp_passive' => q[1], 'ftp_proxy' => q[], 'getcwd' => q[cwd], 'gpg' => q[/usr/bin/gpg], 'gzip' => q[/bin/gzip], 'histfile' => q[/tmp/.cpan/histfile], 'histsize' => q[100], 'http_proxy' => q[], 'inactivity_timeout' => q[0], 'index_expire' => q[1], 'inhibit_startup_message' => q[0], 'keep_source_where' => q[/tmp/.cpan/sources], 'lynx' => q[/usr/bin/lynx], 'make' => q[/usr/bin/make], 'make_arg' => q[], 'make_install_arg' => q[], 'make_install_make_command' => q[/usr/bin/make], 'makepl_arg' => q[ PREFIX=/home/myname], 'mbuild_arg' => q[], 'mbuild_install_arg' => q[], 'mbuild_install_build_command' => q[./Build], 'mbuildpl_arg' => q[], 'ncftpget' => q[/usr/bin/ncftpget], 'no_proxy' => q[], 'pager' => q[/usr/bin/less], 'prefer_installer' => q[EUMM], 'prerequisites_policy' => q[follow], 'scan_cache' => q[atstart], 'shell' => q[/bin/bash], 'show_upload_date' => q[1], 'tar' => q[/bin/tar], 'term_is_latin' => q[1], 'unzip' => q[/usr/bin/unzip], 'urllist' => [q[ftp://ftp.oss.eznetsols.org/cpan], q[ftp://mirror.av +erse.net/pub/CPAN]], 'wget' => q[/usr/bin/wget], }; 1;


---
neversaint and everlastingly indebted.......

Replies are listed 'Best First'.
Re: Installing CPAN module with histfile permission error
by liverpole (Monsignor) on Aug 18, 2006 at 10:37 UTC
    Hi neversaint,

    Is it just an issue of file permissions, perhaps?  The line:

        Couldn't open >/tmp/.cpan/histfile: Permission denied

    seems to indicate that you simply can't write to the file "histfile" in your .cpan directory.

    Please check both the ownership and permissions of the file and its parent directories, with these commands:

    [myname@somehost ~]$ ls -ld /tmp [myname@somehost ~]$ ls -ld /tmp/.cpan [myname@somehost ~]$ ls -l /tmp/.cpan/histfile

    It's likely a fix as easy as something like:

    [myname@somehost ~]$ chown -R /tmp/.cpan `whoami` [myname@somehost ~]$ chmod -R u+rwx /tmp/.cpan

    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Re: Installing CPAN module with histfile permission error
by davorg (Chancellor) on Aug 18, 2006 at 10:23 UTC

    Your username shouldn't really have rights to install modules into the central library repository, so it looks like this server is configured correctly (and I'd be a bit worried about the ones where you can install modules like this!)

    You either need root permissions to install modules into the central library (I like to use 'sudo' for this) or you can install modules into a local library and use the appropriate "use lib" line.

    Update: Hmm... re-reading your post I see there's a specific problem with /tmp/.cpan. Perhaps someone else has been installing modules on that server and has left that directory with problematic permissions. I suggest either removing or renaming that directory (you'll probably need to be root to do that) and trying again.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Installing CPAN module with histfile permission error
by gellyfish (Monsignor) on Aug 18, 2006 at 10:23 UTC

    I would suggest changing the CPAN 'home' directory to somewhere you have write permission. In the CPAN shell do:

    cpan> o conf cpan_home /your/path/of/choice/.cpan cpan> o conf commit

    /J\

      Actually the problem is here:

      'histfile' => q[/tmp/.cpan/histfile],

      Change the options are pointing to /tmp to somewhere like /home/user/tmp or like.

      Igor 'izut' Sutton
      your code, your rules.