X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FClass-MOP.git;a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FAccessor.pm;fp=lib%2FClass%2FMOP%2FMethod%2FAccessor.pm;h=08bcbd179197fc7796ad3d1b669b80bb8a98ebd4;hp=b4377e9d21b32a22e3e82cef99d8bddad4883c37;hb=5efa6a46982d17e1ff642e8b97673c6618fa7e6d;hpb=4b921e6bd2e94a59c73f3c51ace65f4ed677778d diff --git a/lib/Class/MOP/Method/Accessor.pm b/lib/Class/MOP/Method/Accessor.pm index b4377e9..08bcbd1 100644 --- a/lib/Class/MOP/Method/Accessor.pm +++ b/lib/Class/MOP/Method/Accessor.pm @@ -135,15 +135,13 @@ sub _generate_accessor_method_inline { my $attr = $self->associated_attribute; my $code = try { - $self->_compile_code( - source => [ - 'sub {', - $attr->inline_set( '$_[0]', '$_[1]' ) - . ' if scalar(@_) == 2;', - $attr->inline_get('$_[0]') . ';', - '}', - ] - ); + $self->_compile_code([ + 'sub {', + $attr->inline_set('$_[0]', '$_[1]'), + 'if scalar(@_) == 2;', + $attr->inline_get('$_[0]') . ';', + '}', + ]); } catch { confess "Could not generate inline accessor because : $_"; @@ -157,15 +155,13 @@ sub _generate_reader_method_inline { my $attr = $self->associated_attribute; my $code = try { - $self->_compile_code( - source => [ - 'sub {', - 'confess "Cannot assign a value to a read-only accessor" ' - . 'if @_ > 1;', - $attr->inline_get('$_[0]') . ';', - '}', - ], - ); + $self->_compile_code([ + 'sub {', + 'confess "Cannot assign a value to a read-only accessor"', + 'if @_ > 1;', + $attr->inline_get('$_[0]') . ';', + '}', + ]); } catch { confess "Could not generate inline reader because : $_"; @@ -179,13 +175,11 @@ sub _generate_writer_method_inline { my $attr = $self->associated_attribute; my $code = try { - $self->_compile_code( - source => [ - 'sub {', - $attr->inline_set( '$_[0]', '$_[1]' ) . ';', - '}', - ], - ); + $self->_compile_code([ + 'sub {', + $attr->inline_set('$_[0]', '$_[1]') . ';', + '}', + ]); } catch { confess "Could not generate inline writer because : $_"; @@ -199,13 +193,11 @@ sub _generate_predicate_method_inline { my $attr = $self->associated_attribute; my $code = try { - $self->_compile_code( - source => [ - 'sub {', - $attr->inline_has('$_[0]') . ';', - '}', - ], - ); + $self->_compile_code([ + 'sub {', + $attr->inline_has('$_[0]') . ';', + '}', + ]); } catch { confess "Could not generate inline predicate because : $_"; @@ -219,13 +211,11 @@ sub _generate_clearer_method_inline { my $attr = $self->associated_attribute; my $code = try { - $self->_compile_code( - source => [ - 'sub {', - $attr->inline_clear('$_[0]') . ';', - '}', - ], - ); + $self->_compile_code([ + 'sub {', + $attr->inline_clear('$_[0]') . ';', + '}', + ]); } catch { confess "Could not generate inline clearer because : $_";