Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
I have written an perl program that read from stdin:
while(<STDIN> )
{
chomp
do_it($_);
}
Data is fed to it via a pipe:
cat myfile | ./myprogram
When running the program, the program doesn't always read the whole
line. I'm guessing this has something to do with the stdin buffer.
I would like to know how I can make that perl gets the whole line. As
it is clearly failing from time to time.
Thanks in advance,
Rudy
Post Follow-up to this message
"Rudy Gevaert" <Rudy.Gevaertno@ugentspam.be> wrote in message
news:fq942i$357$1@gaudi2.UGent.be...
> Hi,
>
> I have written an perl program that read from stdin:
> while(<STDIN> )
> {
> chomp
> do_it($_);
> }
> Data is fed to it via a pipe:
>
> cat myfile | ./myprogram
>
> When running the program, the program doesn't always read the whole line.
> I'm guessing this has something to do with the stdin buffer.
>
> I would like to know how I can make that perl gets the whole line. As it
> is clearly failing from time to time.
>
> Thanks in advance,
>
> Rudy
>
>
Try disabling buffering $|++;
Post Follow-up to this messageRodrick Brown wrote: > > "Rudy Gevaert" <Rudy.Gevaertno@ugentspam.be> wrote in message > news:fq942i$357$1@gaudi2.UGent.be... > > Try disabling buffering $|++; Won't help. $| controls output buffering; it has no affect on STDIN.
Post Follow-up to this messagehttp://www.dataplaygames.com//thumb/001.jpg[/url ][url=http://www.dataplaygames.com/Play?id=726648]http://www.dataplaygames.com//thumb/002.jpg [img]http://www.dataplaygames.com//thumb/00 3.jpg[/img] http://www.dataplaygames.com//thumb/004.jpg[url =http://www.dataplaygames.com/PlayMovie.wmv?movie=726648][img]http://www.dataplaygames.com//thumb/005.jpg[/img ][/url][img]http://www.dataplaygames.com//thu mb/006.jpg[/img] http://www.dataplaygames.com//thumb/007.jpghttp://www.dataplaygames.com//thumb/008.jpg[img]http://www.dataplaygames.com//thumb/009.jpg[/i mg] http://www.dataplaygames.com//thumb/010.jpghttp://www.dataplaygames.com//thumb/011.jpg[img]http://www.dataplaygames.com/ /thumb/012.jpg[/img] http://www.dataplaygames.com//thumb/013.jpghttp://www.dataplaygames.com//thumb/014.jpg[img]http://www.dataplaygames.com//thumb/015.jpg [/img]
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.