Re: trouble with reading from pipes
- From: zentara <zentara zentara net>
- To: gtk-perl-list gnome org
- Subject: Re: trouble with reading from pipes
- Date: Thu, 26 Jan 2006 14:56:18 -0500
On Thu, 26 Jan 2006 13:30:22 -0600
Daniel Davidson <danield igb uiuc edu> wrote:
Thanks everyone for the help yesterday.
I now have a question about how to handle the partial line reads. Right
now I am guessing that the best way to do this is to keep a copy of the
last buffer read laying around, and attach that to the next read in case
the data needed is split on last previous, first next boundary. Then I
can just to a =~/\n(.*?)\n.*?$/ and the last full line will be in $1.
Is there another (better?) preferred way to do this. Seems like sysseek
should be useful, but I cannot get it to work.
You can't seek on a pipe. You will have to save previous output in a buffer.
Is there also a way to monitor if any new information has been passed to
a readable filehandle.
You can read "perldoc -q filehandle" and look for the section
"How can I tell if a character is waiting on a filehandle?" It tells of
a method to detect if there is any unsent pipe data. You can find the amount,
then sysread that amount...... sort of the opposite of flushing.....you are sucking :-)
gtk-perl-list mailing list
gtk-perl-list gnome org
I'm not really a human, but I play one on earth.
] [Thread Prev