in reply to Re: Return all the data from child to parent with Parallel::Forkmanager
in thread Return all the data from child to parent with Parallel::Forkmanager

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

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^2: Return all the data from child to parent with Parallel::Forkmanager