Skip to content

Commit e623124

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

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
@@ -756,10 +756,7 @@ sub ACTION_config_data {
756756
}
757757

758758
sub array_properties {
759-
for (shift->_mb_classes) {
760-
return @{$additive_properties{$_}->{ARRAY}}
761-
if exists $additive_properties{$_}->{ARRAY};
762-
}
759+
map { exists $additive_properties{$_}->{ARRAY} ? @{$additive_properties{$_}->{ARRAY}} : () } shift->_mb_classes;
763760
}
764761

765762
sub hash_properties {

t/add_property_array.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( 'list_property' => []);
13+
}
14+
15+
ok grep { $_ eq 'bundle_inc' } My::Build::Prop->array_properties, "has bundle_inc even after adding another array property";
16+

0 commit comments

Comments
 (0)