Subject: | Module::Metadata does not extract correct version if use_our is enabled |
If the PkgVersion plugin's "use_our" option is enabled, Module::Metadata fails to extract the correct version from distributions built with this Dist::Zilla plugin bundle.
If the module version is put into curly brackets, like in the current "aliased" and "Test::Warnings" releases, Module::Metadata and in turn Module::Load::Conditional and CPANPLUS do not report the proper module version.
CPANPLUS says that the currently installed version is "Unparsable" and that new versions are available.
CPAN Terminal> o
1 Unparsable 0.019 Test::Warnings ETHER
2 Unparsable 0.33 aliased ETHER
The version information at the top of Test/Warnings.pm is put into curly brackets by Dist::Zilla:
{ our $VERSION = '0.019'; }
The following code snippets return 0 instead of the expected version unless the curly brackets are removed:
use Module::Load::Conditional qw(check_install);
my $rv = check_install( module => 'aliased' );
if ($rv) {
print $rv->{version}, "\n";
}
use Module::Metadata;
my $info = Module::Metadata->new_from_file('path/to/module/aliased.pm');
if ( $info && defined $info->version ) {
print $info->version, "\n";
}