Change the writer for insertion_order to include an underscore prefix
nperez [Fri, 8 May 2009 18:51:33 +0000 (13:51 -0500)]
lib/Class/MOP.pm
lib/Class/MOP/Attribute.pm
lib/Class/MOP/Class.pm

index bdc1783..e9f94f2 100644 (file)
@@ -510,7 +510,7 @@ Class::MOP::Attribute->meta->add_attribute(
 Class::MOP::Attribute->meta->add_attribute(
     Class::MOP::Attribute->new('insertion_order' => (
         reader      => { 'insertion_order' => \&Class::MOP::Attribute::insertion_order },
-        writer      => { 'set_insertion_order' => \&Class::MOP::Attribute::set_insertion_order },
+        writer      => { '_set_insertion_order' => \&Class::MOP::Attribute::_set_insertion_order },
         predicate   => { 'has_insertion_order' => \&Class::MOP::Attribute::has_insertion_order },
     ))
 );
index 6d907ea..e6e9b77 100644 (file)
@@ -179,7 +179,7 @@ sub init_arg           { $_[0]->{'init_arg'}    }
 sub initializer        { $_[0]->{'initializer'} }
 sub definition_context { $_[0]->{'definition_context'} }
 sub insertion_order    { $_[0]->{'insertion_order'} }
-sub set_insertion_order { $_[0]->{'insertion_order'} = $_[1] }
+sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] }
 
 # end bootstrapped away method section.
 # (all methods below here are kept intact)
index a720d17..41fc059 100644 (file)
@@ -831,7 +831,7 @@ sub add_attribute {
     # get our count of previously inserted attributes and
     # increment by one so this attribute knows its order
     my $order = (scalar keys %{$self->get_attribute_map}) - 1; 
-    $attribute->set_insertion_order($order + 1);
+    $attribute->_set_insertion_order($order + 1);
 
     # then onto installing the new accessors
     $self->get_attribute_map->{$attribute->name} = $attribute;