$CPAN::Frontend->mywarn(qq{Unknown shell command '$l'. }.
qq{Type ? for help.
});
}
$autoload_recursion--;
}
}
package CPAN;
use strict;
$META ||= CPAN->new; # In case we re-eval ourselves we need the ||
# from here on only subs.
################################################################################
sub _perl_fingerprint {
my($self,$other_fingerprint) = @_;
my $dll = eval {OS2::DLLname()};
my $mtime_dll = 0;
if (defined $dll) {
$mtime_dll = (-f $dll ? (stat(_))[9] : '-1');
}
my $mtime_perl = (-f CPAN::find_perl ? (stat(_))[9] : '-1');
my $this_fingerprint = {
'$^X' => CPAN::find_perl,
sitearchexp => $Config::Config{sitearchexp},
'mtime_$^X' => $mtime_perl,
'mtime_dll' => $mtime_dll,
};
if ($other_fingerprint) {
if (exists $other_fingerprint->{'stat($^X)'}) { # repair fp from rev. 1.88_57
$other_fingerprint->{'mtime_$^X'} = $other_fingerprint->{'stat($^X)'}[9];
}
# mandatory keys since 1.88_57
for my $key (qw($^X sitearchexp mtime_dll mtime_$^X)) {
return unless $other_fingerprint->{$key} eq $this_fingerprint->{$key};
}
return 1;
} else {
return $this_fingerprint;
}
}
sub suggest_myconfig () {
SUGGEST_MYCONFIG: if(!$INC{'CPAN/MyConfig.pm'}) {
$CPAN::Frontend->myprint("You don't seem to have a user ".
"configuration (MyConfig.pm) yet.\n");
my $new = CPAN::Shell::colorable_makemaker_prompt("Do you want to create a ".
"user configuration now? (Y/n)",
"yes");
if($new =~ m{^y}i) {
CPAN::Shell->mkmyconfig();
return &checklock;
} else {
$CPAN::Frontend->mydie("OK, giving up.");
}
}
}
#-> sub CPAN::all_objects ;
sub all_objects {
my($mgr,$class) = @_;
CPAN::HandleConfig->load unless $CPAN::Config_loaded++;
CPAN->debug("mgr[$mgr] class[$class]") if $CPAN::DEBUG;
CPAN::Index->reload;
values %{ $META->{readwrite}{$class} }; # unsafe meta access, ok
}
# Called by shell, not in batch mode. In batch mode I see no risk in
# having many processes updating something as installations are
# continually checked at runtime. In shell mode I suspect it is
# unintentional to open more than one shell at a time
#-> sub CPAN::checklock ;
sub checklock {
my($self) = @_;
my $lockfile = File::Spec->catfile($CPAN::Config->{cpan_home},".lock");
if (-f $lockfile && -M _ > 0) {
my $fh = FileHandle->new($lockfile) or
$CPAN::Frontend->mydie("Could not open lockfile '$lockfile': $!");
my $otherpid = <$fh>;
my $otherhost = <$fh>;
$fh->close;
if (defined $otherpid && $otherpid) {
chomp $otherpid;
}
if (defined $otherhost && $otherhost) {
chomp $otherhost;
}
my $thishost = hostname();
if (defined $otherhost && defined $thishost &&
$otherhost ne '' && $thishost ne '' &&
$otherhost ne $thishost) {
$CPAN::Frontend->mydie(sprintf("CPAN.pm panic: Lockfile '$lockfile'\n".
"reports other host $otherhost and other ".
"process $otherpid.\n".
"Cannot proceed.\n"));
} elsif ($RUN_DEGRADED) {
$CPAN::Frontend->mywarn("Running in degraded mode (experimental)\n");
=11= |