Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Communicate with child process via stdin, stdout

by quester (Vicar)
on Nov 20, 2011 at 06:41 UTC ( [id://939035]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Communicate with child process via stdin, stdout
in thread Communicate with child process via stdin, stdout

I don't have a copy of DCE-Whisperer to test with, so take this with a grain of salt...

If I change the child process to /bin/cat, I can get the script to run if I uncomment the print $in AND change it to

print $in "PING\n";

which works because (in this case) it flushes the buffer for $in. You could also flush the $in buffer with

$|=1;

depending on the child process - for example cat doesn't work without a "\n".

However, you may be running into buffering issues with DCE-Whisperer as well. As the documentation for IPC::Open2 mentions, "The big problem with this approach [that is, IPC::Open2 itself] is that if you don't have control over source code being run in the child process, you can't control what it does with pipe buffering.... The IO::Pty and Expect modules from CPAN can help with this, as they provide a real tty (well, a pseudo-tty, actually), which gets you back to line buffering in the invoked command again."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://939035]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2025-03-27 16:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (70 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.