fork (and in turn, Parallel::ForkManager) doesn't return data to the parent process and has no provisions to do so.
Nearly right. fork doesn't, but recent versions of Parallel::ForkManager (starting at 0.7.6, released 2010-Aug-15) do allow returning a single data structure, that must be a reference to a string, a hash, or an array. See "RETRIEVING DATASTRUCTURES from child processes" in the documentation of Parallel::ForkManager. What happens there is quite similar to your JSON approach: Parallel::ForkManager serialises the data in the child process using Storable, writes it to disk, and reads it back in the parent, all nearly transparent to the user.
Alexander
In reply to Re^2: Return all the data from child to parent with Parallel::Forkmanager
by afoken
in thread Return all the data from child to parent with Parallel::Forkmanager
by Microcebus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |