simplify more stuff
[gitmo/Class-MOP.git] / lib / Class / MOP / Method / Accessor.pm
index b4377e9..08bcbd1 100644 (file)
@@ -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 : $_";