in reply to Parallel::ForkManager and multiple datasets
I'm attempting the following, but so far am not successful:
#pseudo code use Parallel::ForkManager; my @names = (); my %list = (); my %thing = (); $threads = 20 my $pfm = new Parallel::ForkManager( $threads ); $pfm->run_on_finish( sub { my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_stru +cture_reference) = @_; %list = $data_structure_reference->{%list}; %thing = $data_structure_reference->{%thing}; @names = $data_structure_reference->{@names}; }); FOREACH: foreach my $thing(keys %{$things_hr}) { my $pid = $pfm->start and next; #do stuff push @names, $name; #do stuff $thing{$name}{a} = $value1; $thing{$name}{b} = $value2; #do stuff $list{$id}{$name}{b} = $b; $list{$id}{$name}{e} = $b1; $list{$id}{$name}{a} = 0; $list{$id}{$name}{c} = $ar->[$id][3]; $list{$id}{$name}{i} = $ar->[$id][1]; $list{$id}{$name}{j} = $ar->[$id][2]; $list{$id}{$name}{k} = sprintf("%.4f",$ar->[$id][9]); $pfm->finish( 0, [ \%list, \%thing, \@names ] ); $pfm->wait_all_children;
I'm getting errors about pseudo hashes being deprecated or not existing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parallel::ForkManager and multiple datasets
by Speed_Freak (Sexton) on Jul 05, 2018 at 21:00 UTC | |
by tybalt89 (Monsignor) on Jul 09, 2018 at 03:25 UTC |