Hi!

My callback function shall check a chunk of freshly received data
with a regex. If the regex matches, it shall abort the request.
If it does not match, it shall continue the request and be called
again for the next chunk of data until the whole document is received.

First, I use following callback function:
sub my_callback {
  my ($data,$rs, $protocoll) = @_;

  unless ($rs->is_success()) {
    die "NO_SUCCESS :".$rs->code();
  }

  if ($data =~ m/REGEX/s) {
    warn "Found";
    # do something
    return LWP::Parallel::UserAgent::C_ENDCON;  # abort request.
  }
  # return 1;
}

The callback function was called only once. Thus, only the first chunk
of data was checked with the regex.

I added the 'return 1' and the end of the callback function. 
Now, it's called again until the regex matches. That works fine if
the data matches.

However, if the regex doesn't match in the whole document,
LWP::Parallel::RobotUA continues to call the callback function
with an empty data chunk forever. How can I stop this, once the
whole document is received?

Ciao, Claus      [EMAIL PROTECTED]





-- 
Sent through GMX FreeMail - http://www.gmx.net

Reply via email to