X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMethod%2FGenerate%2FConstructor.pm;h=b69634667949467b5962814fb2264bb9d4c922df;hb=ef4ff8da82d5b2c2635da073084ad2a14b4d2050;hp=50a5659cafb8ec4513d6138373ec27cbf1394cd9;hpb=eb100447a7447ba6620bff6e246d5fc86ecd2c7c;p=gitmo%2FMoo.git diff --git a/lib/Method/Generate/Constructor.pm b/lib/Method/Generate/Constructor.pm index 50a5659..b696346 100644 --- a/lib/Method/Generate/Constructor.pm +++ b/lib/Method/Generate/Constructor.pm @@ -14,8 +14,12 @@ sub register_attribute_specs { die "has '+${name}' given but no ${name} attribute already exists" unless my $old_spec = $specs->{$name}; foreach my $key (keys %$old_spec) { - $new_spec->{$key} = $old_spec->{$key} - unless exists $new_spec->{$key}; + if (!exists $new_spec->{$key}) { + $new_spec->{$key} = $old_spec->{$key} + } + elsif ($key eq 'moosify') { + $new_spec->{$key} = [map { ref $_ eq 'ARRAY' ? @$_ : $_ } ($old_spec->{$key}, $new_spec->{$key})]; + } } } $new_spec->{index} = scalar keys %$specs