Hi Stefan!
> I'm using your module for a current project. I noticed if you
> return '1' from the callback function, LWP::Parallel::UserAgent::wait
> never stops, but with '0' as return value anything is fine.
> I haven't found any documentation on that.
Well, there isn't really any. The only clue is in the small "TestScript.pl"
file in the "t/" folder, where a sample callback sub is given:
sub handle_answer {
my ($content, $response, $protocol, $entry) = @_;
print "Handling answer from '",$response->request->url,": ",
length($content), " bytes, Code ",
$response->code, ", ", $response->message,"\n";
if (length ($content) ) {
# just store content if it comes in
$response->add_content($content);
} else {
# our return value determins how ParallelUA will continue:
# We have to import those constants via "qw(:CALLBACK)"!
# return C_ENDCON; # will end only this connection
# (silly, we already have EOF)
# return C_LASTCON; # wait for remaining open connections,
# but don't issue any new ones!!
# return C_ENDALL; # will immediately end all connections
# and return from $pua->wait
}
# ATTENTION!! If you want to keep reading from your connection,
# you should currently have a final 'return undef' statement here.
# Sometimes ParallelUA will cut the connection if it doesn't
# get it's "undef" here. (that is, unless you want it to end, in
# which case you should use the return values above)
return undef; # just keep on connecting/reading/waiting
}
If you return any number >0 the wait() subroutine will interpret this as
the number of bytes read and thus assume that more data is available on
this connection (not sure why I made this design decision years ago, but it
seems that this was at one point useful).
-m
--
Marc Langheinrich
[EMAIL PROTECTED]