reverting something I shouldnt have commited
Stevan Little [Tue, 15 Apr 2008 22:09:36 +0000 (22:09 +0000)]
lib/Class/MOP/Attribute.pm

index 18b0426..6042f5c 100644 (file)
@@ -253,7 +253,7 @@ sub associate_method {
 sub set_initial_value {
     my ($self, $instance, $value) = @_;
     $self->_set_initial_slot_value(
-        $self->associated_class->get_meta_instance,
+        Class::MOP::Class->initialize(blessed($instance))->get_meta_instance,
         $instance,
         $value
     );
@@ -262,33 +262,33 @@ sub set_initial_value {
 sub set_value {
     my ($self, $instance, $value) = @_;
 
-    $self->associated_class
-         ->get_meta_instance
-         ->set_slot_value($instance, $self->name, $value);
+    Class::MOP::Class->initialize(blessed($instance))
+                     ->get_meta_instance
+                     ->set_slot_value($instance, $self->name, $value);
 }
 
 sub get_value {
     my ($self, $instance) = @_;
 
-    $self->associated_class
-         ->get_meta_instance
-         ->get_slot_value($instance, $self->name);
+    Class::MOP::Class->initialize(blessed($instance))
+                     ->get_meta_instance
+                     ->get_slot_value($instance, $self->name);
 }
 
 sub has_value {
     my ($self, $instance) = @_;
 
-    $self->associated_class
-         ->get_meta_instance
-         ->is_slot_initialized($instance, $self->name);
+    Class::MOP::Class->initialize(blessed($instance))
+                     ->get_meta_instance
+                     ->is_slot_initialized($instance, $self->name);
 }
 
 sub clear_value {
     my ($self, $instance) = @_;
 
-    $self->associated_class
-         ->get_meta_instance
-         ->deinitialize_slot($instance, $self->name);
+    Class::MOP::Class->initialize(blessed($instance))
+                     ->get_meta_instance
+                     ->deinitialize_slot($instance, $self->name);
 }
 
 ## load em up ...