"Octavian Rasnita" <[EMAIL PROTECTED]> writes: > I want to download the top of an html file, parse it for searching a > string, and if that string is found, I want to cancel downloading > the rest of the file. If the string is not found, download the > second part, and so on. > > The problem is that even though I've set the chunk size to 6500, some chunks > have only a few hundread bytes, and this could be a problem because it might > split the string and it won't be found.
There is no guarantees about the size of the chunks returned. The chunk size passed to $ua->request is only a hint, it means that LWP will ask the OS to fill a buffer of that size, but the actual size returned depends on the size and timing of network packets received and bufferering within the OS. If you want to guarantees you have to fill a buffer yourself until you have enough data. Regards, Gisle
