At 16:18 2002-06-13 -0700, [EMAIL PROTECTED] wrote:
>[...](a) the first byte (or packet or chunk?) of the
>response is received, and
>(b) until the entire response is received
>
>I've been doing something close, like this:
>$start_time = [gettimeofday];
>$response = $ua->request( $req,
> sub {
> my($chunk, $res) = @_;
> unless (defined $first_byte_secs) {
> $first_byte_secs =
> tv_interval($start_time);
> }
> $content = $content . $chunk;
> }
> );
Instead if storing it in an external variable, how about storing it in a
fake-o header line in (each) response? I think something like:
$response = $ua->request( $req,
sub { my($chunk, $res) = @_;
$res->init_header('X-Client-Start-Rec', time());
...
return;
}
}
It's been rather a while since I looked around the details (documented and
otherwise) of request() callbacks, but I think that something like the
above might work.
--
Sean M. Burke http://www.spinn.net/~sburke/