From: Vincent Pit Date: Mon, 29 Aug 2011 19:20:05 +0000 (+0200) Subject: Support "package NAME BLOCK" and "package NAME VERSION BLOCK" X-Git-Tag: release_1.0.6~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FModule-Metadata.git;a=commitdiff_plain;h=710f253fd2a61c4545f1edf7811bc102d70d8caa Support "package NAME BLOCK" and "package NAME VERSION BLOCK" --- diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index 514dd1c..bac040a 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -36,7 +36,7 @@ my $PKG_REGEXP = qr{ # match a package declaration \s* # optional whitespace ($V_NUM_REGEXP)? # optional version number \s* # optional whitesapce - ; # semicolon line terminator + [;\{] # semicolon line terminator or block start (since 5.16) }x; my $VARNAME_REGEXP = qr{ # match fully-qualified VERSION name diff --git a/t/metadata.t b/t/metadata.t index b5eda17..c0e0f12 100644 --- a/t/metadata.t +++ b/t/metadata.t @@ -180,6 +180,26 @@ our $VERSION = '1.23_00_00'; our $VERSION; $VERSION = 'onetwothree'; --- + $undef => <<'---', # package NAME BLOCK, undef $VERSION +package Simple { + our $VERSION; +} +--- + '1.23' => <<'---', # package NAME BLOCK, with $VERSION +package Simple { + our $VERSION = '1.23'; +} +--- + '1.23' => <<'---', # package NAME VERSION BLOCK +package Simple 1.23 { + 1; +} +--- + 'v1.2.3_4' => <<'---', # package NAME VERSION BLOCK +package Simple v1.2.3_4 { + 1; +} +--- ); my %modules = reverse @modules;