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

Hi,

I am trying to make a class that installs CPAN modules with the CPAN::Shell package. But if i run a command like:

perl -MCPAN -e 'CPAN::Shell->o("conf")'

It seems like the CPAN::Shell package are not honuring the configuration file. Output is as following:

$CPAN::Config options from : commit [Commit changes to disk] defaults [Reload defaults from disk] help [Short help about 'o conf' usage] init [Interactive setting of all options] applypatch undef auto_commit undef build_cache undef build_dir undef build_dir_reuse undef build_requires_install_policy undef bzip2 undef cache_metadata undef check_sigs undef colorize_debug undef colorize_output undef (...)

Its runned as root, and both Config.pm and MyConfig.pm is located under /root/.cpan/CPAN

Have anyone had this problem before, any suggestions on how to solve this?

Best regards

Replies are listed 'Best First'.
Re: CPAN::Shell not loading CPAN config
by Anonymous Monk on Jul 16, 2010 at 09:04 UTC
    Output is as following...

    Turn on debugging/verbosity, check file permissions

      Hm, cant find any verboose option with -h, but i've tried with the -W options to enable all warnings, nothing file related

      perl -MCPAN -e 'CPAN::Shell->o("conf")' -W

      If its a different command, please enlighten me.

      Since script is runned as root and the config files are owned by root i doubt this is the problem though

        Your language isn't very clear. If I understand the question correctly, then I would try this:
        perl -MCPAN::FirstTime -e 'CPAN::FirstTime::init();'
        And from a script:
        #!/usr/bin/perl use strict; use warnings; use CPAN; use CPAN::FirstTime; CPAN::FirstTime::init(); CPAN::Shell->install( "Bundle::CPAN", "Bundle::LWP");