add map method to Data::Perl::Stream::Array
Matt S Trout [Sat, 20 Feb 2010 22:37:11 +0000 (22:37 +0000)]
lib/Data/Perl/Stream/Array.pm

index 7c0cd09..8d4f325 100644 (file)
@@ -15,6 +15,10 @@ method next {
   return shift @$ary;
 }
 
+method map ($map_func) {
+  ref($self)->new(array => [ map { $map_func->($_) } @{$self->_array} ]);
+}
+
 __PACKAGE__->meta->make_immutable;
 
 1;