+ }
+ }
+
+ my ($pseudo_dist, $latest_dist);
+
+ unless (defined $dist) {
+ $path =~ m{([^/\s]+)$} or die 'Could not get the last part of the path';
+ my $archive = $1;
+ $pseudo_dist = CPAN::DistnameInfo->new($archive);
+
+ p(2, 'is ' . $pseudo_dist->dist . ' the name of a CPAN distribution... ');
+ $latest_dist = do {
+ local $@;
+ eval { $pcp->latest_distribution($pseudo_dist->dist) };
+ };
+
+ unless (defined $latest_dist) {
+ print "no\n";
+ (my $mod_name = $pkg_name) =~ s/-/::/g;
+ p(2, "is $mod_name indexed in another CPAN distribution... ");
+ $latest_dist = do {
+ local $@;
+ eval {
+ my $module = $pcp->package($mod_name);
+ defined $module ? $module->distribution : undef;
+ };
+ };
+ if (defined $latest_dist) {
+ # Re-forge the pseudo dist so that it will pick up the correct dist
+ # name when looking for a mismatch.
+ $pseudo_dist = CPAN::DistnameInfo->new(
+ $latest_dist->dist . '-' . $pseudo_dist->version
+ . '.' . $pseudo_dist->extension
+ );
+ }
+ }
+
+ my ($latest_file, $latest_author);
+ if (defined $latest_dist) {
+ $latest_file = $latest_dist->filename;
+ $latest_author = $latest_dist->cpanid;
+ printf "yes, in %s by %s\n",
+ $latest_file,
+ (defined $latest_author ? $latest_author : 'unknown');
+ } else {
+ print "no\n";
+ }
+
+ if (defined $latest_author) {
+ my ($au, $a) = $latest_author =~ /^((.).)/ or die 'Author name too short';
+ p(2, "is $archive in that author\'s CPAN directory... ");
+ my $alternate_path = "authors/id/$a/$au/$latest_author/$archive";
+ if ($alternate_path eq $path) {
+ print "already checked\n";
+ } elsif (cpan_http_test($alternate_path)) {
+ $dist = CPAN::DistnameInfo->new($alternate_path);
+ print "yes\n";
+ } else {
+ print "no\n";
+ }
+ unless (defined $dist) {
+ push @missing,
+ "$category/$pkg_name (latest is $latest_file by $latest_author)";
+ }
+ }
+ }
+
+ unless (defined $dist) {
+ if ($latest_dist or $is_on_cpan{$pkg_name}) {
+ $dist = $pseudo_dist;
+ p(2, "seems to be a CPAN distribution");
+ if ($latest_dist) {
+ print "\n";
+ } else {
+ # Implies $is_on_cpan{$pkg_name}
+ print " (forced)\n";
+ push @unfindable, "$category/$pkg_name";
+ }
+ } else {