bump version to 1.17
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / natatime.pm
index 9b6f8a2..6fc4a13 100644 (file)
@@ -3,13 +3,25 @@ package Moose::Meta::Method::Accessor::Native::Array::natatime;
 use strict;
 use warnings;
 
-use List::MoreUtils;
+use List::MoreUtils ();
+use Params::Util ();
 
-our $VERSION = '1.14';
+our $VERSION = '1.17';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
-use base 'Moose::Meta::Method::Accessor::Native::Reader';
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Reader' => {
+    -excludes => [
+        qw(
+            _minimum_arguments
+            _maximum_arguments
+            _inline_check_arguments
+            _inline_return_value
+            )
+    ]
+};
 
 sub _minimum_arguments {1}
 
@@ -23,14 +35,14 @@ sub _inline_check_arguments {
         . ' unless defined $_[0] && $_[0] =~ /^\\d+$/;' . "\n"
         . $self->_inline_throw_error(
         q{'The second argument passed to natatime must be a code reference'})
-        . q{ if defined $_[1] && ( ref $_[1] || q{} ) ne 'CODE';};
+        . q{ if @_ == 2 && ! Params::Util::_CODELIKE( $_[1] );};
 }
 
 sub _inline_return_value {
     my ( $self, $slot_access ) = @_;
 
     return
-        "my \$iter = List::MoreUtils::natatime( \$_[0], \@{ $slot_access } );"
+        "my \$iter = List::MoreUtils::natatime( \$_[0], \@{ ($slot_access) } );"
         . "\n"
         . 'if ( $_[1] ) {' . "\n"
         . 'while (my @vals = $iter->()) {' . "\n"
@@ -39,4 +51,9 @@ sub _inline_return_value {
         . 'return $iter;' . "\n" . '}';
 }
 
+# Not called, but needed to satisfy the Reader role
+sub _return_value { }
+
+no Moose::Role;
+
 1;