From: Stevan Little Date: Mon, 4 Jun 2007 04:07:01 +0000 (+0000) Subject: foo X-Git-Tag: 0.18_01~72 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0e744400ae2cc0d7f07dc65252105e595ce738cb;p=gitmo%2FMooseX-AttributeHelpers.git foo --- diff --git a/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm b/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm index d953c97..68db139 100644 --- a/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm +++ b/lib/MooseX/AttributeHelpers/MethodProvider/Array.pm @@ -104,6 +104,22 @@ sub find : method { }; } +sub map : method { + my ($attr) = @_; + return sub { + my ($instance, $f) = @_; + CORE::map { $f->($_) } @{$attr->get_value($instance)} + }; +} + +sub grep : method { + my ($attr) = @_; + return sub { + my ($instance, $predicate) = @_; + CORE::grep { $predicate->($_) } @{$attr->get_value($instance)} + }; +} + 1; __END__