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

Is there any way to convince CPAN to not read/use my home directories .cpan settings, short of moving the directory out of the way? Its particularly problematic on Windows as it's finding a linux .cpan in its list of directories it searches.

Replies are listed 'Best First'.
Re: MyConfig.pm and CPAN
by choroba (Cardinal) on Feb 22, 2015 at 08:11 UTC
    The cpan command supports the -j switch:
    # load a different configuration to install Module::Foo
    cpan -j some/other/file Module::Foo
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Thanks. Tried it out and still ran into a few problems that suggested it hadn't fully ignored the .cpan directory I have.
Re: MyConfig.pm and CPAN
by syphilis (Archbishop) on Feb 22, 2015 at 00:02 UTC
    I'm fairly inexpert in CPAN & friends and not sure about the cause of your exact problem, but I did find out that MyConfig.pm is quite agreeable to hand editing.
    Mine was specifying:
    'make' => q[C:\\_32\\make\\bin\\make.EXE],
    but that was correct only for some of my perls, so I replaced that line with:
    'make' => $Config{make},
    and inserted use Config; at the beginning of the file.

    It's still there in the same state, and working fine - despite that I've installed latest blead a few times since making that alteration.
    I don't know what circumstances will cause this MyConfig.pm to be overwritten but I guess I'll find out one day.

    So .... don't rule out the possibility of being able to make durable changes by hand to MyConfig.pm, though in your case it sounds like you'll want something like:
    if($^O =~ /MSWin32/) { # one list of settings } else { # another list of settings }
    That might be a bit tedious to implement if you don't have both lists at hand.
    And, as I said, I don't really know much about the shortcomings of that approach.

    Cheers,