$ perl -MCPAN -e shellIf this gives an error stating:
Your configuration suggests "/root/.cpan" as yourExecute the following procedure (it worked for me, though I am not sure if all steps are necessary):
CPAN.pm working directory. I could not create this directory due
to this error: mkdir /root/.cpan: Permission denied at /usr/lib/perl5/5.6.1/CPAN.pm line 499
Please make sure the directory exists and is writable.
- 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 shellThis time (if all goes well) it will prompt you for the empty fields in$CPAN::Config
.
- It is OK to accept the default values until it asks you for the parameters for the Makefile.pl
Parameters for the 'perl Makefile.PL' command?You should then answer with the following line:
Typical frequently used settings:
POLLUTE=1 increasing backwards compatibility
LIB=~/perl non-root users (please see manual for more hints)
PREFIX=~/perl5lib/ LIB=~/perl5lib/lib INSTALLMAN1DIR=~/perl5lib/man1 INSTALLMAN3DIR=~/perl5lib/man3This will add the parameters for your user Makefile.
This will enable installations of Modules (.pm) and compile code (.so) in ~/perl5lib/ (more accurately in a subdirectory named after the architecture of your machine). Files for the manual of the modules will also be installled in the specified directories.
- Finish the CPAN configuration by answering all other questions (ex.:
http_proxy?http://your_proxy.yourdomain
).- Set the environment variables for the perl lib path and the manpath. Using bash you should do something like
export PERL5LIB=${PERL5LIB}:~/perl5lib
export MANPATH=~/perl5lib- You should add the environment variable settings to your profile file (in bash ~/.bash_profile)
$ perl -MCPAN -e shellYou should consult the CPAN documentation if you have any doubt.
Last update: 2008/08/30 (GMT)