1 package Moose::Meta::Method::Accessor::Native::Array::natatime;
6 use List::MoreUtils ();
11 with 'Moose::Meta::Method::Accessor::Native::Reader' => {
16 _inline_check_arguments
22 sub _minimum_arguments { 1 }
24 sub _maximum_arguments { 2 }
26 sub _inline_check_arguments {
30 'if (!defined($_[0]) || $_[0] !~ /^\d+$/) {',
31 $self->_inline_throw_error(
32 '"The n value passed to natatime must be an integer"',
35 'if (@_ == 2 && !Params::Util::_CODELIKE($_[1])) {',
36 $self->_inline_throw_error(
37 '"The second argument passed to natatime must be a code '
44 sub _inline_return_value {
46 my ($slot_access) = @_;
49 'my $iter = List::MoreUtils::natatime($_[0], @{ (' . $slot_access . ') });',
51 'while (my @vals = $iter->()) {',
61 # Not called, but needed to satisfy the Reader role