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 comfused 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.