Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: Bidirectional IPC with Expect and Passthrough

by steve (Deacon)
on May 07, 2011 at 04:52 UTC ( #903493=note: print w/replies, xml ) Need Help??

in reply to Re: Bidirectional IPC with Expect and Passthrough
in thread Bidirectional IPC with Expect and Passthrough

Thank you for the quick response.

From Pipe Opens:

"If you would like to open a bidirectional pipe, the IPC::Open2 library will handle this for you."

From Bidirectional Communication with Another Process:

"While this works reasonably well for unidirectional communication, what about bidirectional communication? The obvious thing you'd like to do doesn't actually work:"
open(PROG_FOR_READING_AND_WRITING, "| some program |")
"and if you forget to use the use warnings pragma or the -w flag, then you'll miss out entirely on the diagnostic message:"
Can't do bidirectional pipe at -e line 1.

Am I misinterpreting what that says? I may need to take a step back and revisit this in a bit to get a clearer perspective.

Replies are listed 'Best First'.
Re^3: Bidirectional IPC with Expect and Passthrough
by John M. Dlugosz (Monsignor) on May 07, 2011 at 04:57 UTC
    You need to start "some program" and make two pipes: one feeding to its standard input, and one reading from its standard output. I think there is even a pipe3 version, but don't recall if that's the right thing.

    Without the fancy syntax, you can create a named pipe, and then as a separate step use the redirection syntax ">" to send the output of the program to the pipe you previously opened. You have the other end and can read from that. You can use the pipe syntax for the other direction (only) or use "<" and ">" in the `system` construct to do them both with named pipes.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://903493]
[Corion]: Oh yay. Why do I test a migration with transaction code "T" when the real trades from the migration will come with P9N (which is excluded from the processing)?
[Corion]: (nothing that a quick SQL update can't fix in the input data, but why did the people organizing the test not plan that test under real conditions...)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2017-09-26 15:12 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (296 votes). Check out past polls.