I have a program which I want to have a bi-directional pipe to (i.e both
write and read). I am unable to tee it to a file and then read the file,
so reluctantly started to investigate the IPC modules. I have a snippet of
code here, which again works (sort of), just not in the way that I
need...



#!/usr/bin/perl -w

use IPC::Open2;
use IO::Handle;


$program="maxent";
($reader, $writer) = (IO::Handle->new, IO::Handle->new);
open2($reader, $writer, $program);


chomp($out = <$reader>);

close $reader;
close $writer;
print STDOUT $out."\n";



werd@psw283~/temp$ ./pipe.pl
 Format USR is implimented (True/False) =  T
werd@psw283~/temp$
forrtl: severe (24): end-of-file during read, unit 5, file stdin
cannot read in maxent


As you can see, the line beginning with Format USR..... does indeed read
correctly. However, there are many more lines where this one has come from
and reading them all is the idea. Any clues?
Chears ears,
A.






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to