make github the primary repository
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Hash / set.pm
index 720f350..3185f32 100644 (file)
@@ -6,25 +6,9 @@ use warnings;
 use List::MoreUtils ();
 use Scalar::Util qw( looks_like_number );
 
-our $VERSION = '1.19';
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
-
 use Moose::Role;
 
-with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => {
-    -excludes => [
-        qw(
-            _minimum_arguments
-            _maximum_arguments
-            _inline_process_arguments
-            _inline_check_arguments
-            _inline_coerce_new_values
-            _optimized_set_new_value
-            _return_value
-            )
-    ],
-};
+with 'Moose::Meta::Method::Accessor::Native::Hash::Writer';
 
 sub _minimum_arguments { 2 }
 
@@ -38,7 +22,10 @@ around _inline_check_argument_count => sub {
         $self->$orig(@_),
         'if (@_ % 2) {',
             $self->_inline_throw_error(
-                '"You must pass an even number of arguments to set"',
+                sprintf(
+                    '"You must pass an even number of arguments to %s"',
+                    $self->delegate_to_method,
+                ),
             ) . ';',
         '}',
     );
@@ -60,7 +47,10 @@ sub _inline_check_arguments {
         'for (@keys_idx) {',
             'if (!defined($_[$_])) {',
                 $self->_inline_throw_error(
-                    '"Hash keys passed to set must be defined"',
+                    sprintf(
+                        '"Hash keys passed to %s must be defined"',
+                        $self->delegate_to_method,
+                    ),
                 ) . ';',
             '}',
         '}',
@@ -83,7 +73,7 @@ sub _inline_coerce_new_values {
         'my $iter = List::MoreUtils::natatime(2, @_);',
         '@_ = ();',
         'while (my ($key, $val) = $iter->()) {',
-            'push @_, $key, $member_tc_obj->coerce($val);',
+            'push @_, $key, $member_coercion->($val);',
         '}',
     );
 };
@@ -97,11 +87,11 @@ sub _potential_value {
 
 sub _new_members { '@_[ @values_idx ]' }
 
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
     my $self = shift;
     my ($inv, $new, $slot_access) = @_;
 
-    return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx]';
+    return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx];';
 }
 
 sub _return_value {