User CPAN installation broken

Here is a workaround for a common problem. You do not have root access the *NIX server to configure perl but want to install perl libraries. Normally the user can use CPAN with local libraries (PERL5LIB).

But sometimes CPAN gets confused and you get an error like this:

Your configuration suggests "/root/.cpan" as your CPAN.pm working directory. I could not create this directory due to this error:
mkdir /root/.cpan: Permission denied at /data/eva/perl/lib/perl5/site_perl/5.8.0/CPAN.pm line 552

I search around on Google and found this solution:

Execute the following procedure (it worked for me, though I am not sure if all steps are necessary):

  • Create a directory for the perl modules in your HOME $ mkdir ~/perl5lib
  • Create ~/.cpan and ~/.cpan/CPAN directories: $ mkdir ~/.cpan $ mkdir ~/.cpan/CPAN
  • Create a Config.pm for the CPAN module with $CPAN::Config empty $ echo "\$CPAN::Config = {}" > ~/.cpan/CPAN/MyConfig.pm
  • Execute again: $ perl -MCPAN -e shell

This time (if all goes well) it will prompt you for the empty fields in $CPAN::Config.

One response on “User CPAN installation broken”

Mentions

  • Khürt Williams

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Feel free to comment on this story directly above, but you can also go to copies posted to social media on the left, and reply to or comment on them there. Your responses via Twitter, Facebook, and Google+ will appear below.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)