in reply to Re: Buffered IO and un-intended slurping
in thread Buffered IO and un-intended slurping

There was no mixing of buffered and unbuffered on a file. It all started out buffered; after the lost positioning I converted all the IO calls to unbuffered for that file.

41 is the record size... 40 bytes for the SHA1, 1 byte for the newline .... 40+1=41. I never even touch the $/ value in the program

And keep in mind that this happened just 1 in a 1000 times this module was called.

It is always better to have seen your target for yourself, rather than depend upon someone else's description.

  • Comment on Re^2: Buffered IO and un-intended slurping

Replies are listed 'Best First'.
Re^3: Buffered IO and un-intended slurping
by dk (Chaplain) on Jan 03, 2010 at 10:56 UTC
    If, as you say, you never mix buffered and unbuffered I/O, and never alter $/, then there's something fishy and unexpected. I sincerely doubt that seek() calls, even if done on a buffered stream and even with mixed dos and unix newlines, would produce such an effect. I'd investigate further to find what causes the slurping, at least to make clear if that's a perl bug or not.

    otoh, if you're only interested in a practical solution, just switch to read($f, $buf, 41) instead of readline, which depends on $/.