add Build.PL; update MANIFEST
[gitmo/Class-MOP.git] / examples / ArrayBasedStorage.pod
index 1f04012..cd4dc1e 100644 (file)
@@ -15,7 +15,7 @@ sub new {
     my ($class, $meta, @attrs) = @_;
     my $self = $class->SUPER::new($meta, @attrs);
     my $index = 0;
-    $self->{slot_index_map} = { map { $_ => $index++ } $self->get_all_slots };
+    $self->{'%!slot_index_map'} = { map { $_ => $index++ } $self->get_all_slots };
     return $self;
 }
 
@@ -24,28 +24,28 @@ sub create_instance {
     $self->bless_instance_structure([]);
 }
 
+sub clone_instance {
+    my ($self, $instance) = shift;
+    $self->bless_instance_structure([ @$instance ]);
+}
+
 # operations on meta instance
 
-sub get_slot_index_map { (shift)->{slot_index_map} }
+sub get_slot_index_map { (shift)->{'%!slot_index_map'} }
 
 sub get_all_slots {
     my $self = shift;
-    return sort @{$self->{slots}};
+    return sort $self->SUPER::get_all_slots;
 }
 
 sub get_slot_value {
     my ($self, $instance, $slot_name) = @_;
-    return $instance->[ $self->{slot_index_map}->{$slot_name} ];
+    return $instance->[ $self->{'%!slot_index_map'}->{$slot_name} ];
 }
 
 sub set_slot_value {
     my ($self, $instance, $slot_name, $value) = @_;
-    $instance->[ $self->{slot_index_map}->{$slot_name} ] = $value;
-}
-
-sub initialize_slot {
-    my ($self, $instance, $slot_name) = @_;
-    $instance->[ $self->{slot_index_map}->{$slot_name} ] = undef;
+    $instance->[ $self->{'%!slot_index_map'}->{$slot_name} ] = $value;
 }
 
 sub is_slot_initialized {
@@ -94,15 +94,17 @@ This is very similar now to the InsideOutClass example, and
 in fact, they both share the exact same test suite, with 
 the only difference being the Instance metaclass they use.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
 Stevan Little E<lt>stevan@iinteractive.comE<gt>
 
+Yuval Kogman E<lt>nothingmuch@woobling.comE<gt>
+
 =head1 SEE ALSO
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2006 by Infinity Interactive, Inc.
+Copyright 2006, 2007 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>