instnaces
[gitmo/Class-MOP.git] / examples / ArrayBasedStorage.pod
index 284e558..0702eef 100644 (file)
@@ -1,58 +1,5 @@
 
 package # hide the package from PAUSE
-    ArrayBasedStorage::Attribute;
-
-use strict;
-use warnings;
-
-use Carp 'confess';
-
-our $VERSION = '0.01';
-
-use base 'Class::MOP::Attribute';    
-
-sub generate_accessor_method {
-    my $self = shift;
-    my $attr_name = $self->name;
-    return sub {
-        my $meta_instance = $_[0]->meta->get_meta_instance;            
-        $meta_instance->set_slot_value($_[0], $attr_name, $_[1]) if scalar(@_) == 2;
-        $meta_instance->get_slot_value($_[0], $attr_name);
-    };
-}
-
-sub generate_reader_method {
-    my $self = shift;
-    my $attr_name = $self->name;
-    return sub { 
-        confess "Cannot assign a value to a read-only accessor" if @_ > 1;
-        $_[0]->meta
-             ->get_meta_instance
-             ->get_slot_value($_[0], $attr_name); 
-    };   
-}
-
-sub generate_writer_method {
-    my $self = shift;
-    my $attr_name = $self->name;
-    return sub { 
-        $_[0]->meta
-             ->get_meta_instance
-             ->set_slot_value($_[0], $attr_name, $_[1]);
-    };
-}
-
-sub generate_predicate_method {
-    my $self = shift;
-    my $attr_name = $self->name;
-    return sub {        
-        defined $_[0]->meta
-                     ->get_meta_instance
-                     ->get_slot_value($_[0], $attr_name) ? 1 : 0;
-    };
-}    
-
-package # hide the package from PAUSE
     ArrayBasedStorage::Instance;
 
 use strict;
@@ -121,7 +68,6 @@ ArrayBasedStorage - An example of an Array based instance storage
   package Foo;
   
   use metaclass 'Class::MOP::Class' => (
-    ':attribute_metaclass' => 'ArrayBasedStorage::Attribute'
     ':instance_metaclass'  => 'ArrayBasedStorage::Instance'
   );