From: Karen Etheridge Date: Thu, 25 Nov 2010 19:32:08 +0000 (-0800) Subject: clarification re the limitations of the "map" array delegation handler X-Git-Tag: 1.9900~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a13637fcd26eae050005b5c78153812d1ea83a1;p=gitmo%2FMoose.git clarification re the limitations of the "map" array delegation handler --- diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm index 9c4f2ad..1de1760 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Array.pm @@ -166,6 +166,10 @@ This method transforms every element in the array and returns a new array, just like Perl's core C function. This method requires a subroutine which implements the transformation. +Note that if you add or subtract values within the supplied coderef, the +values are I saved back to the attribute. You need to use the attribute +writer wrapped around the map call for that. + my @mod_options = $stuff->map_options( sub { $_ . "-tag" } ); print "@mod_options\n"; # prints "foo-tag bar-tag baz-tag boo-tag"