Skip to content

Commit c6e15d3

Browse files
pliceaseLeont
authored andcommitted
don't clobber standard hash attributes in subclasses that have their own hash attributes.
1 parent ecb8c4d commit c6e15d3

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

lib/Module/Build/Base.pm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,7 @@ sub ACTION_config_data {
763763
}
764764

765765
sub hash_properties {
766-
for (shift->_mb_classes) {
767-
return @{$additive_properties{$_}->{'HASH'}}
768-
if exists $additive_properties{$_}->{'HASH'};
769-
}
766+
map { exists $additive_properties{$_}->{HASH} ? @{$additive_properties{$_}->{HASH}} : () } shift->_mb_classes;
770767
}
771768

772769
sub add_property {

t/add_property_hash.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/perl -w
2+
3+
use strict;
4+
use lib 't/lib';
5+
use MBTest tests => 1;
6+
7+
blib_load 'Module::Build';
8+
9+
ADDPROP: {
10+
package My::Build::Prop;
11+
use base 'Module::Build';
12+
__PACKAGE__->add_property( 'hash_property' => {});
13+
}
14+
15+
ok grep { $_ eq 'install_path' } My::Build::Prop->hash_properties, "has install_path even after adding another hash property";
16+

0 commit comments

Comments
 (0)