Skip to content

when searching for a package line, allow apostrophes in the module name #1346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/MetaCPAN/Document/Module.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ my $bom
sub hide_from_pause {
my ( $self, $content, $file_name ) = @_;
return 0 if defined($file_name) && $file_name =~ m{\.pm\.PL\z};
my $pkg = $self->name;
my $pkg = $self->name;
my $pkg_match = join q[(?:::|')], map quotemeta, split m{::}, $pkg;

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