Make array accessor follow same pattern as hash accessor
Dave Rolsky [Fri, 24 Sep 2010 16:15:59 +0000 (11:15 -0500)]
lib/Moose/Meta/Method/Accessor/Native/Array/accessor.pm

index 54d7f40..cc5d244 100644 (file)
@@ -62,11 +62,15 @@ sub _generate_method {
     $code .= "\n" . $self->_inline_get_old_value_for_trigger($inv);
     $code .= "\n" . $self->_inline_capture_return_value($slot_access);
 
-    $code
-        .= "\n" . $self->_inline_store( $inv, '[' . $potential_value . ']' );
+    $code .= "\n"
+        . $self->_inline_set_new_value(
+        $inv,
+        $potential_value,
+        $slot_access,
+        );
 
-    $code .= "\n" . $self->_inline_post_body(@_);
     $code .= "\n" . $self->_inline_trigger( $inv, $slot_access, '@old' );
+    $code .= "\n" . $self->_inline_post_body(@_);
 
     $code .= "\n}";
     $code .= "\n}";