From: Dave Rolsky Date: Tue, 21 Sep 2010 18:13:46 +0000 (-0500) Subject: Move some code to Native/Writer since it is the same for all native types X-Git-Tag: 1.15~127 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa072458f2961291db63a1b1cbf9fc4720f61690;p=gitmo%2FMoose.git Move some code to Native/Writer since it is the same for all native types --- diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/Writer.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/Writer.pm index 768337a..fe22c03 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/Writer.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/Writer.pm @@ -12,24 +12,8 @@ use base qw( Moose::Meta::Method::Accessor::Native::Writer ); -sub _inline_process_arguments {q{}} - -sub _inline_check_arguments {q{}} - sub _new_value {'@_'} -sub _inline_copy_value { - my ( $self, $potential_ref ) = @_; - - return q{} unless $self->_value_needs_copy; - - my $code = "my \$potential = ${$potential_ref};"; - - ${$potential_ref} = '$potential'; - - return $code; -} - sub _value_needs_copy { my $self = shift; @@ -134,8 +118,6 @@ sub _inline_get_old_value_for_trigger { . '} ] : ()' . ";\n"; } -sub _return_value { return q{} } - sub _eval_environment { my $self = shift; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Writer.pm b/lib/Moose/Meta/Method/Accessor/Native/Writer.pm index d304e28..09db4bf 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Writer.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Writer.pm @@ -74,6 +74,18 @@ sub _inline_check_arguments {q{}} sub _value_needs_copy {0} +sub _inline_copy_value { + my ( $self, $potential_ref ) = @_; + + return q{} unless $self->_value_needs_copy; + + my $code = "my \$potential = ${$potential_ref};"; + + ${$potential_ref} = '$potential'; + + return $code; +} + sub _inline_tc_code { die '_inline_tc_code must be overridden by ' . ref $_[0]; }