in reply to Re^2: How to set pipe first and then use the forkmanager?
in thread How to set pipe first and then use the forkmanager?

Presumably, you're forking because your input data files are very large. The time taken to open a pipe is then negligible compared to the time needed for processing your data.

Don't forget that premature optimization is the source of almost all evil.

  • Comment on Re^3: How to set pipe first and then use the forkmanager?

Replies are listed 'Best First'.
Re^4: How to set pipe first and then use the forkmanager?
by mlin (Novice) on Sep 23, 2016 at 09:57 UTC
    Thanks! I'll use this form at the moment, maybe I solve the problem when I know more about the fork. I have a new question: ----- complement: while the program A runs, it usually prints some information or warnings to the screen? Will it be a trouble for the forked processes? or I must throw the output of A, like:
    foreach (@data_files) { open $h, "| program_A 2>& /dev/null" or die ...; print $h ...; print $h ...; ... } close($h);
    Can I hold those information? Thanks!
      Hmm, not entirely sure, but I don't think that the forked process will care about that.

      On the other hand, you might want to redirect to a log file (not /dev/null), if only to help getting a diagnostic if your process has errors and fails.