Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://903493]
help
Chatterbox?
[LanX]:  last hour of cb doesn't break
[LanX]: 12345678901234- 123456789012345678 901234567890123456 789012345678901234 567890123456789012 345678901234567890 123456789012345678 901234567890123456 789012345678901234 567890123456789012 345678901234567890 123456789012345678 901234567890123456 789012345678901234 567890

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2017-07-24 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (351 votes). Check out past polls.