And a follow-on question:
Any idea why I have to send the yprtool two "\n"s instead of one to make it work? With just one it hangs... On the command line, it definitely works with just one. ************************************** ($y,$p,$r) = (split(' ', $lines[15]))[11..13]; use IPC::Open2; local (*GETYPR, *SENDYPR); $pid = open2(\*GETYPR, \*SENDYPR, "$yprtool -l 90 0 0 "); print SENDYPR "$y $p $r\n\n"; ($y2, $p2, $r2) = split(' ',<GETYPR>); close GETYPR; close SENDYPR; print "y: $y, p: $p, r: $r\n"; print "y2: $y2, p2: $p2, r2: $r2\n"; ************************************** TIA. - Bryan > That does it, thanks, Wiggins! > > - B > > > >> Bryan R Harris wrote: >>> >>> I'd like to open 2-way pipe to a tool that we have here. It's called >>> yprtool and once it's open, you give it 3 numbers to its STDIN and it spits >>> out 3 numbers to its STDOUT. It stays open until you ctrl-c it. >>> >>> What's the correct syntax for opening something like this? >>> >>> This doesn't work: >>> >>> ************************************** >>> $yprtool = '/Users/bh/Library/models/yprtool'; >>> open(YPRTOOL, "+<$yprtool|") or die "open error blah"; >>> print YPRTOOL "$a $b $c\n"; >>> $return = <YPRTOOL>; >>> close(YPRTOOL) or die "a cruel death"; >>> ************************************** >>> >>> I think the problem is in the "+<", but I'm not sure. >>> >>> - B >>> >> >> Check out the IPC::Open2 and IPC::Open3 modules, they are standard. >> >> perldoc IPC::Open2 >> perldoc IPC::Open3 >> >> Additionally there is good information available in, >> >> perldoc perlipc >> >> http://danconia.org > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>