Skip Menu |

This queue is for tickets about the future CPAN distribution.

Report information
The Basics
Id: 105558
Status: resolved
Priority: 0/
Queue: future

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.33



Subject: Future::Utils::fmap* should pass item via $_
That it only comes by @_ currently comes as surprising, as the function's name suggests map-like behaviour. $_ would be suitable. -- Paul Evans
On Mon Jun 29 13:54:56 2015, PEVANS wrote: Show quoted text
> That it only comes by @_ currently comes as surprising, as the > function's name suggests map-like behaviour. $_ would be suitable.
Done. -- Paul Evans
Subject: rt105558.patch
=== modified file 'lib/Future/Utils.pm' --- lib/Future/Utils.pm 2015-03-10 19:55:41 +0000 +++ lib/Future/Utils.pm 2015-07-28 14:46:30 +0000 @@ -489,6 +489,9 @@ the result future will differ in each function's case; they are documented below. +For similarity with perl's core C<map> function, the item is also available +aliased as C<$_>. + =cut # This function is invoked in two circumstances: @@ -518,7 +521,7 @@ return $return; } - my $f = $slots->[$idx] = Future->call( $code, $item ); + my $f = $slots->[$idx] = Future->call( $code, local $_ = $item ); if( $collect eq "array" ) { push @$results, my $r = []; === modified file 't/35utils-map-void.t' --- t/35utils-map-void.t 2014-03-26 15:09:41 +0000 +++ t/35utils-map-void.t 2015-07-28 14:46:30 +0000 @@ -13,6 +13,7 @@ { my @subf; my $future = fmap_void { + is( $_, $_[0], 'item passed in $_ as well as @_' ); return $subf[$_[0]] = Future->new } foreach => [ 0 .. 2 ];
Released in 0.33 -- Paul Evans