Subject: | CPAN::HandleConfig::home ignores "undef" return from File::HomeDir->my_data |
CPAN::HandleConfig::home does not handle a return of "undef" from
File::HomeDir->my_data. In my particular network configuration this
arises, causing CPAN to incorrectly ignore my ~/.cpan/CPAN/MyConfig.pm
and try to run CPAN::FirstTime::init. (I'm not sure why it does the
latter, but that's not part of this bug report.)
The details: CPAN is being invoked in a ssh session into an OS X box,
which gets its user account information via NIS. My account is
"foreign" (i.e. not created on the Mac) and File::HomeDir->my_data()
returns "undef" (which seems appropriate).
Unfortunately, this causes CPAN::HandleConfig::load to ignore my
existing ~/.cpan/CPAN/MyConfig.pm (as the path to it is now wrong) and
to try to create a new one. (It should be noted that
CPAN::FirstTime::init uses a different algorithm to determine where the
config file goes; it just uses $ENV{HOME}).
The most obvious solution would be to check the return from
File::HomeDir->my_data and if it is "undef" to fall back to using
$ENV{HOME} or File::HomeDir->my_home.