Skip to content

Commit f5c5057

Browse files
authored
Merge pull request #1346 from metacpan/haarg/module-indexed-match-apostrophe
when searching for a package line, allow apostrophes in the module name
2 parents e1057e8 + e2c089d commit f5c5057

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/MetaCPAN/Document/Module.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ my $bom
114114
sub hide_from_pause {
115115
my ( $self, $content, $file_name ) = @_;
116116
return 0 if defined($file_name) && $file_name =~ m{\.pm\.PL\z};
117-
my $pkg = $self->name;
117+
my $pkg = $self->name;
118+
my $pkg_match = join q[(?:::|')], map quotemeta, split m{::}, $pkg;
118119

119120
# This regexp is *almost* the same as $PKG_REGEXP in Module::Metadata.
120121
# [b] We need to allow/ignore a possible BOM since we read in binary mode.
@@ -128,7 +129,7 @@ sub hide_from_pause {
128129
[\h\{;]* # intro chars on a line [s]
129130
package # the word 'package'
130131
\h+ # whitespace [s]
131-
(\Q$pkg\E) # a package name [p]
132+
($pkg_match) # the package name [p]
132133
(\h+ v?[0-9._]+)? # optional version number (preceded by whitespace) [v]
133134
\h* # optional whitesapce [s]
134135
[;\{] # semicolon line terminator or block start

0 commit comments

Comments
 (0)