Skip to content

Commit 762356c

Browse files
committed
Fix package version parsing in $PKG_REGEXP
The regexp was parsing "package xx::3;" as package "xx", version "3"
1 parent 477f75e commit 762356c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Module/Metadata.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ my $PKG_REGEXP = qr{ # match a package declaration
6868
package # the word 'package'
6969
\s+ # whitespace
7070
($PKG_NAME_REGEXP) # a package name
71-
\s* # optional whitespace
72-
($V_NUM_REGEXP)? # optional version number
71+
(?:
72+
\s+ # whitespace
73+
($V_NUM_REGEXP) # optional version number
74+
)?
7375
\s* # optional whitesapce
7476
[;\{] # semicolon line terminator or block start (since 5.16)
7577
}x;

0 commit comments

Comments
 (0)