'Module::Metadata' =>
{
'MAINTAINER' => 'dagolden',
- 'DISTRIBUTION' => 'DAGOLDEN/Module-Metadata-1.000005.tar.gz',
+ 'DISTRIBUTION' => 'DAGOLDEN/Module-Metadata-1.000006.tar.gz',
'FILES' => q[cpan/Module-Metadata],
'EXCLUDED' => [ qr{^maint}, qr{^xt} ],
'UPSTREAM' => 'cpan',
use strict;
use vars qw($VERSION);
-$VERSION = '1.000005_01';
+$VERSION = '1.000006';
$VERSION = eval $VERSION;
use File::Spec;
\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
use IO::File;
use MBTest;
+my $undef;
+
# parse various module $VERSION lines
# these will be reversed later to create %modules
my @modules = (
+ $undef => <<'---', # no $VERSION line
+package Simple;
+---
+ $undef => <<'---', # undefined $VERSION
+package Simple;
+our $VERSION;
+---
'1.23' => <<'---', # declared & defined on same line with 'our'
package Simple;
our $VERSION = '1.23';
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;
# Test::Builder will prematurely numify objects, so use this form
my $errs;
- ok( $pm_info->version eq $expected,
- "correct module version (expected '$expected')" )
- or $errs++;
+ my $got = $pm_info->version;
+ if ( defined $expected ) {
+ ok( $got eq $expected,
+ "correct module version (expected '$expected')" )
+ or $errs++;
+ } else {
+ ok( !defined($got),
+ "correct module version (expected undef)" )
+ or $errs++;
+ }
is( $warnings, '', 'no warnings from parsing' ) or $errs++;
- diag "Got: '@{[$pm_info->version]}'\nModule contents:\n$module" if $errs;
+ diag "Got: '$got'\nModule contents:\n$module" if $errs;
}
}