Add explicit return values for (almost) all native delegation mutating methods
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / String / chomp.pm
index 14b5b48..5068958 100644 (file)
@@ -14,22 +14,29 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => {
         qw(
             _maximum_arguments
             _inline_optimized_set_new_value
+            _return_value
             )
     ]
 };
 
-sub _maximum_arguments { 0 }
+sub _maximum_arguments {0}
 
 sub _potential_value {
     my ( $self, $slot_access ) = @_;
 
-    return "( do { my \$val = $slot_access; chomp \$val; \$val } )";
+    return "( do { my \$val = $slot_access; \@return = chomp \$val; \$val } )";
 }
 
 sub _inline_optimized_set_new_value {
     my ( $self, $inv, $new, $slot_access ) = @_;
 
-    return "chomp $slot_access";
+    return "\@return = chomp $slot_access";
+}
+
+sub _return_value {
+    my ( $self, $slot_access ) = @_;
+
+    return '$return[0]';
 }
 
 no Moose::Role;