keyservers like pgp.mit.edu (port 11371).
});
$CPAN::Frontend->mysleep(2);
}
}
} else {
delete $INC{$file}; # if it inc'd LWP but failed during, say, URI
}
return 0;
}
#-> sub CPAN::instance ;
sub instance {
my($mgr,$class,$id) = @_;
CPAN::Index->reload;
$id ||= "";
# unsafe meta access, ok?
return $META->{readwrite}{$class}{$id} if exists $META->{readwrite}{$class}{$id};
$META->{readwrite}{$class}{$id} ||= $class->new(ID => $id);
}
#-> sub CPAN::new ;
sub new {
bless {}, shift;
}
#-> sub CPAN::cleanup ;
sub cleanup {
# warn "cleanup called with arg[@_] End[$CPAN::End] Signal[$Signal]";
local $SIG{__DIE__} = '';
my($message) = @_;
my $i = 0;
my $ineval = 0;
my($subroutine);
while ((undef,undef,undef,$subroutine) = caller(++$i)) {
$ineval = 1, last if
$subroutine eq '(eval)';
}
return if $ineval && !$CPAN::End;
return unless defined $META->{LOCK};
return unless -f $META->{LOCK};
$META->savehist;
close $META->{LOCKFH};
unlink $META->{LOCK};
# require Carp;
# Carp::cluck("DEBUGGING");
if ( $CPAN::CONFIG_DIRTY ) {
$CPAN::Frontend->mywarn("Warning: Configuration not saved.\n");
}
$CPAN::Frontend->myprint("Lockfile removed.\n");
}
#-> sub CPAN::readhist
sub readhist {
my($self,$term,$histfile) = @_;
my $histsize = $CPAN::Config->{'histsize'} || 100;
$term->Attribs->{'MaxHistorySize'} = $histsize if (defined($term->Attribs->{'MaxHistorySize'}));
my($fh) = FileHandle->new;
open $fh, "<$histfile" or return;
local $/ = "\n";
while (<$fh>) {
chomp;
$term->AddHistory($_);
}
close $fh;
}
#-> sub CPAN::savehist
sub savehist {
my($self) = @_;
my($histfile,$histsize);
unless ($histfile = $CPAN::Config->{'histfile'}) {
$CPAN::Frontend->mywarn("No history written (no histfile specified).\n");
return;
}
$histsize = $CPAN::Config->{'histsize'} || 100;
if ($CPAN::term) {
unless ($CPAN::term->can("GetHistory")) {
$CPAN::Frontend->mywarn("Terminal does not support GetHistory.\n");
return;
}
} else {
return;
}
my @h = $CPAN::term->GetHistory;
splice @h, 0, @h-$histsize if @h>$histsize;
my($fh) = FileHandle->new;
open $fh, ">$histfile" or $CPAN::Frontend->mydie("Couldn't open >$histfile: $!");
local $\ = local $, = "\n";
print $fh @h;
close $fh;
}
#-> sub CPAN::is_tested
sub is_tested {
my($self,$what,$when) = @_;
unless ($what) {
Carp::cluck("DEBUG: empty what");
return;
=16= |