Your skill will accomplish
what the force of many cannot
"There's also an open3() for tridirectional I/O so you can also catch your child's STDERR, but doing so would then require an awkward select() loop and wouldn't allow you to use normal Perl input operations."
The difficulty here is that the conversation follows a slightly different path - user input and program output may occur simultaneously.
Perhaps an a more specific example would be useful. Let's say that I want to make a wrapper for top which allows me to receive the output of the top program (as regularly as possible) and also allows for me to parse the output and if a particular listing is present, return a keystroke/string automatically to top to switch the view so that that process is more easily noticed.
So with output such as:
no automated action would need to be performed, whereas with this output:
would automatically send a string to top to update the view to be more like:
The crux of this issue is that user input and program output may occur at any time. I am not aware of a method in perl that allows for receiving data from two sources simultaneously.
With that being stated, I do not need instant reads/writes from either the program output or the user input. What I do need is a way to not lose any potential data in between. If it takes a few milliseconds to read user input, and the program has output during that time I will need to read that after the user input. I would also like to avoid losing keystrokes for user input while the script is reading/checking program output.
Perhaps this would also require a fork so one child could always read/write from/to the program, and the other would always read/write from/to the user?
In reply to Re^2: Bidirectional IPC with Expect and Passthrough