CC: | Dave Rolsky <autarch [...] urth.org> |
Subject: | [BUGFIX-PATCH] MooseX::ClassAttribute::Trait::Mixin::HasClassAttributes 'insertion_order' not correct |
Date: | Fri, 9 Feb 2018 10:40:05 +0100 |
To: | bug-moosex-classattribute [...] rt.cpan.org |
From: | Carsten Paeth <calle [...] calle.in-berlin.de> |
Hello Dave,
While working with ClassAttributes I detect that the 'insertion_order'
for the ClassAttributes are not correct.
workaround in my code for now:
my $attr = $meta->add_class_attribute( $name, %options );
my $order = ( scalar keys %{ $meta->get_class_attribute_map } );
$attr->_set_insertion_order($order);
Here a patch that fixes that bug:
--- HasClassAttributes.pm 2018-02-09 10:29:41.052120601 +0100
+++ HasClassAttributes-fixed.pm 2018-02-09 10:30:17.604499218 +0100
@@ -43,7 +43,7 @@
$self->remove_class_attribute($attr_name)
if $self->has_class_attribute($attr_name);
- my $order = ( scalar keys %{ $self->_attribute_map } );
+ my $order = ( scalar keys %{ $self->_class_attribute_map } );
$attribute->_set_insertion_order($order);
$self->_add_class_attribute( $attr_name => $attribute );
best regards,
calle