POE-Component-Curl-Multi
view release on metacpan or search on metacpan
lib/POE/Component/Curl/Multi.pm view on Meta::CPAN
my $count = $kernel->call('ua' => 'pending_requests_count');
This is also available as a method on the object returned by C<spawn>
my $count = $curl->pending_requests_count();
=head2 C<shutdown>
Responds to all pending requests with 408 (request timeout), and then
shuts down the component and all subcomponents.
=head1 SENT EVENTS
=head2 response handler
In addition to all the usual POE parameters, HTTP responses come with
two list references:
my ($request_packet, $response_packet) = @_[ARG0, ARG1];
C<$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
C<$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.
=head2 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;
}
=head1 STREAMING
This component does not (yet) support L<POE::Component::Client::HTTP>'s streaming options.
=head1 CLIENT HEADERS
POE::Component::Curl::Multi sets its own response headers with
additional information. All of its headers begin with "X-PCCH".
=head2 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.
=head2 X-PCCH-Peer
This response header is not yet supported.
=head1 ATTRIBUTION
POE::Component::Curl::Multi is based on both
L<POE::Component::Client::HTTP> by Rocco Caputo, Rob Bloodgood and Martijn van Beers
and
L<AnyEvent::Curl::Multi> by Michael S. Fischer
=head1 SEE ALSO
L<Net::Curl>
L<AnyEvent::Curl::Multi>
L<POE::Component::Client::HTTP>
=head1 AUTHOR
Chris Williams
=head1 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.
=cut
( run in 1.874 second using v1.01-cache-2.11-cpan-39bf76dae61 )