I'd like to create two child processes, pipe the first one's STDOUT into the second one's STDIN, and read the first one's STDERR. After reading the pipe manpage and perlipc I came up with this (broken) piece of code :
my ($READ, $WRITE); pipe ($READ, $WRITE); my $child1 = fork (); unless ($child1) { *STDOUT = $WRITE; exec ('cat', $0); } my $child2 = fork (); unless ($child2) { *STDIN = $READ; exec ('grep', 'grep'); } waitpid ($child1, 0); waitpid ($child2, 0);
I think my error is in the assignments to STDIN and STDOUT. I don't fully understand globs, so what you see here is mainly guesswork. I think what I need is some sort of equivalement to the C system call dup2. Any thoughts?
thank you for your time
MT
In reply to Pipe two child processes by MediaTracker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |