Thank you - that was exactly what I was looking for. | [reply] |
If you don't need interaction, consider a two-stage fork, which is safer than having one program both send and recieve with IPC::Open3, since you can never deadlock by being the wrong state. For example:
if (open RESULTS, "-|") {
# I am the original process, so read from <RESULTS> below
} else {
# I am the kid
if (open STDIN, "|-") {
# I am still the kid, but my STDIN is now piped from the grandkid
exec "your", "big", "application";
die "can't find big application: $!";
} else { # I am the grandkid: be a data pump
print "$_\n" for @input_data;
exit 0;
}
}
while (<RESULTS>) {
....
}
This double-fork data-pump is a nice pattern to keep in mind.
| [reply] [d/l] |