'does',
'handles',
'init_arg',
+ 'insertion_order',
'is',
'isa',
'lazy',
# Moose defines, but Mouse doesn't
#'definition_context',
#'initializer',
- #'insertion_order',
# special case for AttributeHelpers
'provides',
weaken( $attr->{associated_class} = $self );
+ $attr->{insertion_order} = keys %{ $self->{attributes} };
$self->{attributes}{$attr->name} = $attr;
$attr->install_accessors();
sub should_coerce { $_[0]->{coerce} }
sub documentation { $_[0]->{documentation} }
+sub insertion_order { $_[0]->{insertion_order} }
# predicates
Class->write_attr(42);
};
+my @attrs = map { $_->name }
+ sort { $a->insertion_order <=> $b->insertion_order } $object->meta->get_all_attributes;
+is join(' ', @attrs), 'x y z attr', 'insertion_order';
+
done_testing;
INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_auto_deref, auto_deref);
INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_coerce, coerce);
INSTALL_SIMPLE_READER(Attribute, documentation);
+ INSTALL_SIMPLE_READER(Attribute, insertion_order);
/* predicates */
INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_accessor, accessor);