the circle is now complete attic/iterative
Stevan Little [Wed, 26 Jul 2006 20:43:15 +0000 (20:43 +0000)]
lib/Class/MOP.pm

index f32f15a..f97b142 100644 (file)
@@ -165,23 +165,34 @@ Class::MOP::Attribute->meta->add_attribute(
 
 ## Class::MOP::Iterator
 
-=pod
-
 Class::MOP::Iterator->meta->add_attribute(
     Class::MOP::Attribute->new('generator' => (
-        accessor => 'generator',
+        accessor => { 
+            # NOTE: we need to do this in order 
+            # not fall into meta-circular death            
+            'generator' => sub {
+                my $self = shift;
+                $self->{generator} = shift if @_;
+                $self->{generator};                
+            }
+        }
     )),
 );
 
 Class::MOP::Iterator->meta->add_attribute(
     Class::MOP::Attribute->new('predicate' => (
-        accessor => 'predicate',
+        accessor => { 
+            # NOTE: we need to do this in order 
+            # not fall into meta-circular death            
+            'predicate' => sub {
+                my $self = shift;
+                $self->{predicate} = shift if @_;
+                $self->{predicate};
+            }
+        }
     )),
 );
 
-=cut
-
-
 # NOTE: (meta-circularity)
 # This should be one of the last things done
 # it will "tie the knot" with Class::MOP::Attribute