slightly72 has asked for the wisdom of the Perl Monks concerning the following question:
Then at some point I write the command to the stdin of the server (now piped through $wrt). The problem is with reading from the stdout of the server, piped through $rdr.use IO::Handle;<br> my ($wrt, $rdr) = (IO::Handle->new(), IO::Handle->new()); my $procid = open2($wrt, $rdr, $server_command_line);
I have looked into File::Tail, but that seems to work only for regular files and not pipes. I've looked also into using threads, as per a reply to a similar problem on perlmonks, but again the issue is that that solution worked with 'records' (i.e. usually lines).while (1) { if (there_is_something_to_read($rdr)) { $reply = get_everything_from_the_pipe($rdr); last; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading partial lines/strings from a pipe
by philcrow (Priest) on Oct 10, 2007 at 18:06 UTC | |
by slightly72 (Initiate) on Oct 10, 2007 at 18:24 UTC | |
|
Re: Reading partial lines/strings from a pipe
by kyle (Abbot) on Oct 10, 2007 at 18:15 UTC |