Of course, since the child process does generate output, this might cause some trouble if you don't redirect it somewhere -- just add " > junkfile.name" after the name of the program in the open statement. (This mightopen( PIPE, "| comparepass.exe" ); print PIPE "some_file.name\n"; close PIPE;
<update> if you really are running the program on a unix system, and you really don't need the stuff that the program spits out, redirect like this: &> /dev/null (that will send both stdout and stderr to the bitbucket). </update>
If you know you need to capture the output from the program for use in your script, the next easiest thing to try is IPC::Open2. With that, you get two file handles, one to send input to the program, and the other to read its output.
If you don't know what input you'll give to the program until you get its initial "menu" output, and the program was written in such a way that its output ends up being buffered when its stdout is not a terminal, then you'll need to use expect.
In reply to Re: Interacting with a child process
by graff
in thread Interacting with a child process
by K_M_McMahon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |