MCE::Hobo uses MCE::Shared for IPC. You may prefer MCE::Child to not involve a shared-manager process. MCE::Child uses MCE::Channel for IPC. MCE::Channel came long after making MCE::Hobo and thought to make something similar that works with Perl v5.8.1 and above.
use v5.10.1;
use MCE::Child;
MCE::Child->init(
max_workers => 50,
posix_exit => 1,
on_finish => sub {
my ($pid, $exit_code, $ident, $exit_signal, $error, $resp) = @
+_;
print "child $pid completed: $ident => ", $resp->[0], "\n";
}
);
foreach my $data ( 1..2000 ) {
MCE::Child->create( $data, sub {
MCE::Child->yield(0.008);
# sleep 1; # simulate connection instantiation
[ $data * 2 ];
});
}
MCE::Child->wait_all;
Writing MCE::Child was helpful in improving MCE::Hobo and vice versa. Yeah, there are two similar modules. MCE::Child is mostly compatible with MCE::Hobo. MCE::Hobo is more compatible with threads, but requires Perl v5.10.1 minimally.