Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 120516
Status: rejected
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: KES [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Resources are merged incorrectly for meta_merge because of two level deep
/Module/Build/Base.pm:851: my %new = (%{ $prop }, @_); $property meta_merge e $prop { resources => { homepage => "https://github.com/KES777/XS-Utils", repository => "https://github.com/KES777/XS-Utils", }, } e \%new { resources => { x_IRC => "irc://" }, } e $x->{$property} on line 854 { resources => { x_IRC => "irc://" }, } EXPECTED: { resources => { homepage => "https://github.com/KES777/XS-Utils", repository => "https://github.com/KES777/XS-Utils", x_IRC => "irc://", }, }
And possible warning is not issued due to described problem. [problem with warnings](https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues/123)
On Sun Mar 05 17:38:03 2017, KES wrote: Show quoted text
> /Module/Build/Base.pm:851: my %new = (%{ $prop }, @_); > > $property > meta_merge > e $prop > { > resources => { > homepage => "https://github.com/KES777/XS-Utils", > repository => "https://github.com/KES777/XS-Utils", > }, > } > e \%new > { > resources => { x_IRC => "irc://" }, > } > > > e $x->{$property} on line 854 > { > resources => { x_IRC => "irc://" }, > } > > > EXPECTED: > { > resources => { > homepage => "https://github.com/KES777/XS-Utils", > repository => "https://github.com/KES777/XS-Utils", > x_IRC => "irc://", > }, > }
This ticket is very confusing. Can you describe how you got here? Leon
$cat Build.PL use strict; use warnings; use Module::Build::Pluggable ReadmeMarkdownFromPod => # { clean => 1 }, Repository => GithubMeta => CPANfile => XSUtil => { cc_warnings => 1, ppport => "ppport.h", }, ; my $builder = Module::Build::Pluggable->new( module_name => 'XS::Utils', dist_author => 'Eugen Konkov <kes-kes@yandex.ru>', license => 'perl', create_makefile_pl => 'traditional', create_readme => 1, create_license => 1, meta_merge => { resources => { ### This will be replaced by ::Repostirory bugtracker => 'url', x_IRC => "irc://irc.perl.org/#channel", repository => 'url', }} ); $builder->create_build_script; Both modules: Repository and GithubMeta setup "resources". Last one have precendence. As result we have only hash which setup 'GithubMeta'. Repository and one from Module::Build are replaced /Module/Build/Base.pm:851: my %new = (%{ $prop }, @_); This will look like: %new = resources => { ### This will be replaced by ::Repostirory bugtracker => 'url', x_IRC => "irc://irc.perl.org/#channel", repository => 'url', }, resources => { \%HASH FROM Repository }, resources => { \%HASH FROM GithubMeta }) You probably should: use Hash::Merge::Simple qw/ clone_merge /; %new = clone_merge resources => { ### This will be replaced by ::Repostirory bugtracker => 'url', x_IRC => "irc://irc.perl.org/#channel", repository => 'url', } ,resources => { \%HASH FROM Repository } ,resources => { \%HASH FROM GithubMeta }
On Mon Mar 06 09:12:52 2017, KES wrote: Show quoted text
> $cat Build.PL > use strict; > use warnings; > > use Module::Build::Pluggable > ReadmeMarkdownFromPod => # { clean => 1 }, > Repository => > GithubMeta => > CPANfile => > XSUtil => { > cc_warnings => 1, > ppport => "ppport.h", > }, > ; > > my $builder = Module::Build::Pluggable->new( > module_name => 'XS::Utils', > dist_author => 'Eugen Konkov <kes-kes@yandex.ru>', > license => 'perl', > create_makefile_pl => 'traditional', > create_readme => 1, > create_license => 1, > meta_merge => { resources => { ### This will be replaced by > ::Repostirory > bugtracker => 'url', > x_IRC => "irc://irc.perl.org/#channel", > repository => 'url', > }} > ); > > $builder->create_build_script; > > > > Both modules: Repository and GithubMeta setup "resources". Last one > have precendence. > > As result we have only hash which setup 'GithubMeta'. Repository and > one from Module::Build are replaced > > > /Module/Build/Base.pm:851: my %new = (%{ $prop }, @_); > This will look like: > > %new = resources => { ### This will be replaced by ::Repostirory > bugtracker => 'url', > x_IRC => "irc://irc.perl.org/#channel", > repository => 'url', > }, resources => { \%HASH FROM Repository }, resources => { \%HASH FROM > GithubMeta }) > > You probably should: > > use Hash::Merge::Simple qw/ clone_merge /; > %new = clone_merge > resources => { ### This will be replaced by ::Repostirory > bugtracker => 'url', > x_IRC => "irc://irc.perl.org/#channel", > repository => 'url', > } > ,resources => { \%HASH FROM Repository } > ,resources => { \%HASH FROM GithubMeta }
This is not a bug in Module::Build, but in Module::Build::Pluggable. It's using the meta_merge accessor as if it is a non-accessor method (when you call it, you replace the current meta_merge value). Leon