Skip to content

Commit bc36d7b

Browse files
committed
use normalized documentation name when comparing to module name
When checking if a file should be marked as indexed, if the documentation name (from the abstract) exists it is required to match the module name. The module name is normalized to use double colons rather than possibly apostrophes. Also normalize the documentation name when doing this comparison.
1 parent d1a4eb8 commit bc36d7b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/MetaCPAN/Document/File.pm

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -932,16 +932,22 @@ sub set_indexed {
932932
);
933933
}
934934

935-
$self->_set_indexed(
936-
(
935+
if ( my $doc_name = $self->documentation ) {
937936

938-
# .pm file with no package declaration but pod should be indexed
939-
!@{ $self->module } ||
937+
# normalize the documentation name for comparison the same way module
938+
# names are normalized
939+
my $normalized_doc_name = $doc_name =~ s{'}{::}gr;
940+
$self->_set_indexed(
941+
(
942+
# .pm file with no package declaration but pod should be indexed
943+
!@{ $self->module } ||
940944

941945
# don't index if the documentation doesn't match any of its modules
942-
!!grep { $self->documentation eq $_->name } @{ $self->module }
943-
) ? true : false
944-
) if ( $self->documentation );
946+
grep { $normalized_doc_name eq $_->name }
947+
@{ $self->module }
948+
) ? true : false
949+
);
950+
}
945951
}
946952

947953
=head2 set_authorized

0 commit comments

Comments
 (0)