Re: Can LWP/libwww to "streaming" read?

Martijn Koster (mak@webcrawler.com)
Fri, 3 Oct 1997 12:23:36 +0100


On Thu, Oct 02, 1997 at 03:49:34PM -0400, John Chambers wrote:

> Can LWP support this sort of access?  Or does it  have  to  read  the
> entire thing in first before returning to the caller?
> 
> If so, are there any code examples  that  illustrate  this?   Say,  a
> little  test that will look for "fubar" in the first 10 lines, and if
> that string isn't there, closes the connection and  goes  on  to  the
> next URL in <>.

Here's an off-the-wall idea: `perldoc LWP::UserAgent`

     ...
     SYNOPSIS
     ...
           $response = $ua->request($request, \&callback, 4096);
     ...
          The subroutine variant requires a reference to callback
          routine as the second argument to request() and it can also
          take an optional chuck size as third argument.  This variant
          can be used to construct "pipe-lined" processing, where
          processing of received chuncks can begin before the complete
          data has arrived.
      ...

Any help?

-- Martijn Koster, m.koster@pobox.com