1 package Moose::Meta::Method::Accessor::Native::Array::natatime;
6 use List::MoreUtils ();
9 our $AUTHORITY = 'cpan:STEVAN';
13 with 'Moose::Meta::Method::Accessor::Native::Reader' => {
18 _inline_check_arguments
24 sub _minimum_arguments { 1 }
26 sub _maximum_arguments { 2 }
28 sub _inline_check_arguments {
32 'if (!defined($_[0]) || $_[0] !~ /^\d+$/) {',
33 $self->_inline_throw_error(
34 '"The n value passed to natatime must be an integer"',
37 'if (@_ == 2 && !Params::Util::_CODELIKE($_[1])) {',
38 $self->_inline_throw_error(
39 '"The second argument passed to natatime must be a code '
46 sub _inline_return_value {
48 my ($slot_access) = @_;
51 'my $iter = List::MoreUtils::natatime($_[0], @{ (' . $slot_access . ') });',
53 'while (my @vals = $iter->()) {',
63 # Not called, but needed to satisfy the Reader role