Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Bidirectional IPC with Expect and Passthrough

by steve (Deacon)
on May 07, 2011 at 04:52 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://903493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-03-19 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found