From: nperez Date: Fri, 8 May 2009 18:25:56 +0000 (-0500) Subject: insertion order should be zero based, obviously X-Git-Tag: 0.84~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ae9f2581973cf5470488d1f53a868e0e860f458;p=gitmo%2FClass-MOP.git insertion order should be zero based, obviously --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 1889d04..42739a3 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -830,7 +830,8 @@ sub add_attribute { # get our count of previously inserted attributes and # increment by one so this attribute knows its order - $attribute->insertion_order((scalar keys %{$self->get_attribute_map}) + 1); + my $order = (scalar keys %{$self->get_attribute_map}) - 1; + $attribute->insertion_order($order + 1); # then onto installing the new accessors $self->get_attribute_map->{$attribute->name} = $attribute;