use strict;
use vars qw(%can %keys $dot_cpan $VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 423 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 431 $,4)/100;
%can = (
'commit' => "Commit changes to disk",
*default = \&defaults;
sub defaults {
my($self) = @_;
- $self->unload;
- $self->load;
+ my $done;
+ for my $config (qw(CPAN/MyConfig.pm CPAN/Config.pm)) {
+ CPAN::Shell->reload_this($config) and $done++;
+ last if $done;
+ }
1;
}
my($path_to_cpan) = File::Basename::dirname($INC{"CPAN.pm"});
my($configpmdir) = File::Spec->catdir($path_to_cpan,"CPAN");
my($configpmtest) = File::Spec->catfile($configpmdir,"Config.pm");
+ my $inc_key;
if (-d $configpmdir or File::Path::mkpath($configpmdir)) {
- $configpm = _configpmtest($configpmdir,$configpmtest);
+ $configpm = _configpmtest($configpmdir,$configpmtest);
+ $inc_key = "CPAN/Config.pm";
}
unless ($configpm) {
$configpmdir = File::Spec->catdir($ENV{HOME},".cpan","CPAN");
File::Path::mkpath($configpmdir);
$configpmtest = File::Spec->catfile($configpmdir,"MyConfig.pm");
- $configpm = _configpmtest($configpmdir,$configpmtest);
- unless ($configpm) {
- my $text = qq{WARNING: CPAN.pm is unable to } .
- qq{create a configuration file.};
- output($text, 'confess');
- }
+ $configpm = _configpmtest($configpmdir,$configpmtest);
+ $inc_key = "CPAN/MyConfig.pm";
}
+ if ($configpm) {
+ $INC{$inc_key} = $configpm;
+ } else {
+ my $text = qq{WARNING: CPAN.pm is unable to } .
+ qq{create a configuration file.};
+ output($text, 'confess');
+ }
+
}
local($") = ", ";
$CPAN::Frontend->myprint(<<END) if $redo && ! $theycalled;
return @miss;
}
-sub unload {
- delete $INC{'CPAN/MyConfig.pm'};
- delete $INC{'CPAN/Config.pm'};
-}
-
sub help {
$CPAN::Frontend->myprint(q[
Known options:
use strict;
use vars qw($AUTOLOAD $VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 423 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 431 $,4)/100;
# formerly CPAN::HandleConfig was known as CPAN::Config
sub AUTOLOAD {