POE-Component-Curl-Multi
view release on metacpan or search on metacpan
This is also available as a method on the object returned by spawn
my $count = $curl->pending_requests_count();
shutdown
Responds to all pending requests with 408 (request timeout), and then
shuts down the component and all subcomponents.
SENT EVENTS
response handler
In addition to all the usual POE parameters, HTTP responses come with
two list references:
my ($request_packet, $response_packet) = @_[ARG0, ARG1];
$request_packet contains a reference to the original HTTP::Request
object. This is useful for matching responses back to the requests that
generated them.
my $http_request_object = $request_packet->[0];
my $http_request_tag = $request_packet->[1]; # from the 'request' post
$response_packet contains a reference to the resulting HTTP::Response
object.
my $http_response_object = $response_packet->[0];
Please see the HTTP::Request and HTTP::Response manpages for more
information.
progress handler
The example progress handler shows how to calculate a percentage of
download completion.
sub progress_handler {
my $gen_args = $_[ARG0]; # args passed to all calls
my $call_args = $_[ARG1]; # args specific to the call
my $req = $gen_args->[0]; # HTTP::Request object being serviced
my $tag = $gen_args->[1]; # Request ID tag from.
my $got = $call_args->[0]; # Number of bytes retrieved so far.
my $tot = $call_args->[1]; # Total bytes to be retrieved.
my $percent = $got / $tot * 100;
printf(
"-- %.0f%% [%d/%d]: %s\n", $percent, $got, $tot, $req->uri()
);
return;
}
STREAMING
This component does not (yet) support POE::Component::Client::HTTP's
streaming options.
CLIENT HEADERS
POE::Component::Curl::Multi sets its own response headers with
additional information. All of its headers begin with "X-PCCH".
X-PCCH-Errmsg
POE::Component::Curl::Multi may fail because of an internal client
error rather than an HTTP protocol error. X-PCCH-Errmsg will contain a
human readable reason for client failures, should they occur.
The text of X-PCCH-Errmsg may also be repeated in the response's
content.
X-PCCH-Peer
This response header is not yet supported.
ATTRIBUTION
POE::Component::Curl::Multi is based on both
POE::Component::Client::HTTP by Rocco Caputo, Rob Bloodgood and Martijn
van Beers
and
AnyEvent::Curl::Multi by Michael S. Fischer
SEE ALSO
Net::Curl
AnyEvent::Curl::Multi
POE::Component::Client::HTTP
AUTHOR
Chris Williams
COPYRIGHT AND LICENSE
This software is copyright (c) 2023 by Chris Williams, Michael S.
Fischer, Rocco Caputo, Rob Bloodgood and Martijn van Beers.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
( run in 2.450 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )