This method requires a single argument.
+=item * B<grep_in_place( sub { ... } )>
+
+This method greps through the array I<in place>, modifying the attributes value.
+This method accepts a subroutine which implements the matching logic.
+
+This method does not define a return value.
+
+
=item * B<map( sub { ... } )>
This method transforms every element in the array and returns a new array,
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Array::grep_in_place;
+
+use strict;
+use warnings;
+
+use Params::Util ();
+
+our $VERSION = '1.9900';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => {
+ -excludes => [
+ qw(
+ _maximum_arguments
+ _inline_check_arguments
+ _return_value
+ )
+ ]
+};
+
+sub _maximum_arguments { 1 }
+sub _minimun_arguments { 1 }
+
+sub _inline_check_arguments {
+ my $self = shift;
+ return $self->_inline_throw_error(
+ q{'The argument passed to grep_in_place must be a code reference'})
+ . q{ unless Params::Util::_CODELIKE( $_[0] );};
+}
+
+sub _adds_members { 0 }
+
+sub _potential_value {
+ my ($self, $slot_access) = @_;
+
+ return '[ grep { $_[0]->($_) } @{ (' . $slot_access . ') } ]';
+}
+
+sub _return_value { '' }
+
+no Moose::Role;
+
+1;
map => 'map',
map_curried => [ map => ( sub { $_ + 1 } ) ],
grep => 'grep',
+ grep_in_place => 'grep_in_place',
grep_curried => [ grep => ( sub { $_ < 5 } ) ],
first => 'first',
first_curried => [ first => ( sub { $_ % 2 } ) ],
$obj->grep_curried( sub { } );
}, qr/Cannot call grep with more than 1 argument/, 'throws an error when passing one argument passed to grep_curried' );
+ $obj->_values( [ 1, 2, 3, 4, 5, 6, 7, 8 ] );
+
+ $obj->grep_in_place(sub { $_ > 4 } );
+
+ is_deeply (
+ $obj->_values,
+ [5, 6, 7, 8],
+ 'grep_in_place alters attribute vars'
+ );
+
$obj->_values( [ 2, 4, 22, 99, 101, 6 ] );
is(