in reply to co-processes

I'm not sure what you mean by "co-process handling". It seems to me that you are executing a command and reading its output. Is that it? In that case, one way of doing it with perl would be:
open(CMD, "co_process_program |") or die "Error: $!\n"; while(<CMD>) { # each line of input will be in $_ } close(CMD);