I want to get a hash with all elements from all children using Parallel::ForkManager
.
use strict;
use Parallel::ForkManager;
my @arr2 = (a, b, c, d);
foreach ( @arr2 ) {
$pid = $pm->start
$hash{$_} = localtime;
# STORE ABOVE ELEMENT TO EXIST HASH
my $pid = $pm->start and next;
}
$pm->wait_all_children;
READ %hash
output
$hash{a} = 11:02
$hash{b} = 11:03
$hash{c} = 11:04
$hash{d} = 11:05
Is it possible to share elements of hash by run_on_exit
callback? Or I must use an external file? Which module does it in the easiest way? I tried IPC::Shareable and DBM::Deep. They do not work on my script.