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

Hi All,

I'd like to use both cygwin perl and native strawberry perl on the same machine. Because they both find ~/.cpan I think it would make a mess to use them like this, right? They are two different versions, and also there are modules that compiles with gcc, so I don't believe it would work out right.

So I need two CPAN work dirs for the two perl dist. I have noticed that strawberry goes fine just with it's system CPAN dir until it doesn't find the ~/.cpan/MyConfig.pm, but when I have one from cygwin perl, it starts to use it.
There is a function in CPAN HandleConfig.pm where I reversed the search order for config file, and it works now:
sub require_myconfig_or_config () {
if ( $INC{"CPAN/Config.pm"} || _try_loading("CPAN::Config") ) {
return $INC{"CPAN/Config.pm"};
}
elsif ( $INC{"CPAN/MyConfig.pm"} || _try_loading("CPAN::MyConfig", cpan_home())) {
return $INC{"CPAN/MyConfig.pm"};
}
else {
return q{};
}
}
.. but it is a really bad hack of course.

Can you suggest a clean way to operate cygwin and strawberry dist together, each having separate ~/.cpan and ~/perl5 dir?

My question would stand for more separate strawberry dists too.

Thanks

Replies are listed 'Best First'.
Re: More cpan_home for more perl dist
by Anonymous Monk on Dec 13, 2014 at 07:48 UTC

    I'd like to use both cygwin perl and native strawberry perl on the same machine. Because they both find ~/.cpan I think it would make a mess to use them like this, right?

    No.

    cygwin concept of $HOME is different from windows concept of home , but even if it wasn't, cpan can generally share the same directory without problems.

    If for some reason cpan can't, cpanplus can do it

    You can configure each install through a custom CPAN::Config installed in site or vendor libs

    Can you suggest a clean way to operate cygwin and strawberry dist together, each having separate ~/.cpan and ~/perl5 dir?

    Don't keep them both in %PATH%, and don't use MyConfig

Re: More cpan_home for more perl dist
by wazat (Monk) on Dec 13, 2014 at 18:02 UTC

    As Anonymous Monk, remarked cygwin and windows don't have the same concept of home.

    In the past I've had ActiveState perl and cygwin perl coexist. You problem never cropped up. I used a different home directory for cygwin something like /home/myself (equivalent to /cygdrive/c//home/myself). While my motivation wasn't to get the 2 perls to coexist in peace, this approach could work for you.