Subject: | "require" used as expression in Build.PL/Makefile.PL generating bad META.* |
This construct doesn't do what you think it does:
"x_HASH(0x8875e08)" : null,
As demonstrated by this test code:
#!perl
use strict;
use warnings;
use Data::Dumper qw( Dumper );
print Dumper({ require "./MYMETA.pl" });
Which simply emits:
$VAR1 = {
'HASH(0x244e158)' => undef
};
This is because META.pl contains data in *list* form, and require() only returns scalars.
Perhaps what you want to do is wrap MYMETA.pl in a { }, and then use:
%{ require './MYMETA.pl' },
Instead.
#!perl
use strict;
use warnings;
use Data::Dumper qw( Dumper );
my $struct = {
"meta-spec" => { version => 2 },
%{ require "./MYMETA.pl" },
};
print Dumper($struct);
$VAR1 = {
'resources' => {
'repository' => {
'url' => 'git://github.com/jtbraun/Parse-RecDescent',
'type' => 'git',
'web' => 'https://github.com/jtbraun/Parse-RecDescent'
},
'bugtracker' => {
'web' => 'https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=Parse-RecDescent'
}
},
'meta-spec' => {
'version' => 2
}
};
Personally I think relying on the return value of require is asking for trouble, but the above seems to work.
--
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )