FTP.pm (CPAN-2.27) | : | FTP.pm (CPAN-2.28) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
use File::Basename qw(dirname); | use File::Basename qw(dirname); | |||
use File::Path qw(mkpath); | use File::Path qw(mkpath); | |||
use CPAN::FTP::netrc; | use CPAN::FTP::netrc; | |||
use vars qw($connect_to_internet_ok $Ua $Thesite $ThesiteURL $Themethod); | use vars qw($connect_to_internet_ok $Ua $Thesite $ThesiteURL $Themethod); | |||
@CPAN::FTP::ISA = qw(CPAN::Debug); | @CPAN::FTP::ISA = qw(CPAN::Debug); | |||
use vars qw( | use vars qw( | |||
$VERSION | $VERSION | |||
); | ); | |||
$VERSION = "5.5012"; | $VERSION = "5.5013"; | |||
sub _plus_append_open { | sub _plus_append_open { | |||
my($fh, $file) = @_; | my($fh, $file) = @_; | |||
my $parent_dir = dirname $file; | my $parent_dir = dirname $file; | |||
mkpath $parent_dir; | mkpath $parent_dir; | |||
my($cnt); | my($cnt); | |||
until (open $fh, "+>>$file") { | until (open $fh, "+>>$file") { | |||
next if exists &Errno::EAGAIN && $! == &Errno::EAGAIN; # don't increment on EAGAIN | next if exists &Errno::EAGAIN && $! == &Errno::EAGAIN; # don't increment on EAGAIN | |||
$CPAN::Frontend->mydie("Could not open '$file' after 10000 tries: $!") i f ++$cnt > 100000; | $CPAN::Frontend->mydie("Could not open '$file' after 10000 tries: $!") i f ++$cnt > 100000; | |||
sleep 0.0001; | sleep 0.0001; | |||
skipping to change at line 41 | skipping to change at line 41 | |||
} | } | |||
#-> sub CPAN::FTP::ftp_statistics | #-> sub CPAN::FTP::ftp_statistics | |||
# if they want to rewrite, they need to pass in a filehandle | # if they want to rewrite, they need to pass in a filehandle | |||
sub _ftp_statistics { | sub _ftp_statistics { | |||
my($self,$fh) = @_; | my($self,$fh) = @_; | |||
my $ftpstats_size = $CPAN::Config->{ftpstats_size}; | my $ftpstats_size = $CPAN::Config->{ftpstats_size}; | |||
return if defined $ftpstats_size && $ftpstats_size <= 0; | return if defined $ftpstats_size && $ftpstats_size <= 0; | |||
my $locktype = $fh ? LOCK_EX : LOCK_SH; | my $locktype = $fh ? LOCK_EX : LOCK_SH; | |||
# XXX On Windows flock() implements mandatory locking, so we can | # XXX On Windows flock() implements mandatory locking, so we can | |||
# XXX only use shared locking to still allow _yaml_load_file() to | # XXX only use shared locking to still allow _yaml_loadfile() to | |||
# XXX read from the file using a different filehandle. | # XXX read from the file using a different filehandle. | |||
$locktype = LOCK_SH if $^O eq "MSWin32"; | $locktype = LOCK_SH if $^O eq "MSWin32"; | |||
$fh ||= FileHandle->new; | $fh ||= FileHandle->new; | |||
my $file = File::Spec->catfile($CPAN::Config->{cpan_home},"FTPstats.yml"); | my $file = File::Spec->catfile($CPAN::Config->{cpan_home},"FTPstats.yml"); | |||
_plus_append_open($fh,$file); | _plus_append_open($fh,$file); | |||
my $sleep = 1; | my $sleep = 1; | |||
my $waitstart; | my $waitstart; | |||
while (!CPAN::_flock($fh, $locktype|LOCK_NB)) { | while (!CPAN::_flock($fh, $locktype|LOCK_NB)) { | |||
$waitstart ||= localtime(); | $waitstart ||= localtime(); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |