App-cpanoutdated-coro
view release on metacpan or search on metacpan
script/cpan-outdated-coro view on Meta::CPAN
}
}
### schedule
$cv_main->recv;
close $fh;
exit;
sub _parse_gz {
local $_=<$fh>;
unless (defined $_) {
push @{$ch{scan}}, undef;
return 1;
}
chomp;
my ( $pkg, $version, $dist ) = split ' ';
## ***PKG: $pkg
return if $version eq 'undef';
# $Mail::SpamAssassin::Conf::VERSION is 'bogus'
# https://rt.cpan.org/Public/Bug/Display.html?id=73465
return unless $version =~ /[0-9]/;
# if excluding core modules
return
if $exclude_core && exists $core_modules->{$pkg};
return
if $dist =~ m{/perl-[0-9._]+\.tar\.(gz|bz2)$};
my @a = split '::', $pkg . '.pm', $depth + 1;
pop @a if @a > $depth;
return unless $prev_path{ lc( join( '/', @a ) ) };
### ***PUSH: $pkg
push @{$ch{scan}}, [ $pkg, $version, $dist, ];
return;
}
sub _scan_inc {
return unless @{$ch{scan}}+0;
my $get = shift @{$ch{scan}};
unless (defined $get) {
push @{$ch{info}}, undef;
return 1;
}
( my $file = @$get[0] ) =~ s[::][/]g;
$file .= '.pm';
for my $dir (@libpath) {
my $path = join '/', $dir, $file;
next unless -f $path;
### --------PATH: $path
push @{$ch{info}}, [ $path, @$get ];
return;
}
return;
## --NOTFOUND: $file
}
# ignore old distribution.
# This is a heuristic approach. It is not a strict.
# If you want a strict check, cpan-outdated looks 02packages.details.txt.gz twice.
# It is too slow.
#
# But, 02packages.details.txt.gz is sorted.
# Submodules are listed after main module most of the time.
# This strategy works well for now.
# ref https://github.com/tokuhirom/cpan-outdated/issues#issue/4
sub _get_info {
return unless @{$ch{info}}+0;
my $get = shift @{$ch{info}};
unless (defined $get) {
push @{$ch{rep}}, undef;
return 1;
}
my ( $path, $pkg, $version, $dist ) = @{$get};
my $info = CPAN::DistnameInfo->new($dist);
if ( my $latest = $dist_latest_version{ $info->dist } ) {
# $info->version < $latest
if ( compare_version( $info->version, $latest ) ) {
return;
}
}
$dist_latest_version{ $info->dist } = $info->version;
my $meta = do {
local $SIG{__WARN__} = sub { };
Module::Metadata->new_from_file($path);
};
my $inst_version = $meta->version($pkg);
return unless defined $inst_version;
if ( compare_version( $inst_version, $version ) ) {
return if $seen{$dist}++;
push @{$ch{rep}}, [ $pkg, $inst_version, $version, $dist ];
### ++: $pkg;
}
return;
}
sub _report {
if(@{$ch{rep}}) {
my $get = shift @{$ch{rep}};
unless (defined $get) {
$cv_main->send;
return 1;
}
my ( $pkg, $inst_version, $version, $dist ) = @{$get};
if ($verbose) {
printf "%-30s %-7s %-7s %s\n", $pkg, $inst_version, $version,
$dist;
}
elsif ($print_package) {
print "$pkg\n";
}
else {
print "$dist\n";
}
}
return;
}
( run in 1.945 second using v1.01-cache-2.11-cpan-39bf76dae61 )