Skip Menu |

This queue is for tickets about the Parallel-Loops CPAN distribution.

Report information
The Basics
Id: 60659
Status: resolved
Priority: 0/
Queue: Parallel-Loops

People
Owner: Nobody in particular
Requestors: art.bugorski [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.03
Fixed in: (no value)



Subject: Does not work with string parameters
Despite what it says in the CPAN page it does not pass the parameters into $_ as can be seen with the following code. ---------------- #!/usr/bin/perl use strict; use warnings; use subs; use vars; use lib; use Parallel::Loops; # A variation of the example given @ http://search.cpan.org/~pmorch/Parallel-Loops-0.03/lib/Parallel/Loops.pm#SYNOPSIS my $maxProcs = 5; my $pl = Parallel::Loops->new($maxProcs); our @parameters = ( "Homer", "Marge", "Bart", "Lisa", "Maggie" ); #= ( 0..10 ); my %returnValues; $pl->share( \%returnValues ); # # ACCORDING TO CPAN PAGE: # ... with $_ set foreach element in @$arrayRef, except that $childBodySub is run in a forked child process to obtain parallelism. # $pl->foreach( \@parameters, sub { print "Number :( $_\n";#should print names but prints numbers instead :( print "Name ?:S $parameters[$_]\n";#WORKS... but is confusing print "\n"; my @a; push @a, "$_ Simpson"; $returnValues{$_} = \@a; }); foreach (@parameters) { my $arr_ref = $returnValues{$_}; my @rv = @$arr_ref; my $rvv = $rv[0]; printf "i: $_ sqrt(i): $rvv\n"; }
Sorry, I didn't get emails notifications which is why they're only fixed now. Fixed in 0.04