]>
Dogcows Code - chaz/p5-HTTP-AnyUA/blob - lib/HTTP/AnyUA/Backend/LWP/UserAgent.pm
1 package HTTP
::AnyUA
::Backend
::LWP
::UserAgent
;
2 # ABSTRACT: A unified programming interface for LWP::UserAgent
8 our $VERSION = '0.900'; # VERSION
10 use parent
'HTTP::AnyUA::Backend';
12 use HTTP
::AnyUA
::Util
;
17 my ($method, $url, $args) = @_;
19 my $r = HTTP
::AnyUA
::Util
::native_to_http_request
(@_);
21 my $ua_resp = $self->ua->request($r);
23 return $self->_munge_response($ua_resp, $args->{data_callback
});
34 success
=> !!$ua_resp->is_success,
35 url
=> $ua_resp->request->uri->as_string,
36 status
=> $ua_resp->code,
37 reason
=> $ua_resp->message,
38 headers
=> HTTP
::AnyUA
::Util
::http_headers_to_native
($ua_resp->headers),
41 $resp->{protocol
} = $ua_resp->protocol if $ua_resp->protocol;
44 for my $redirect ($ua_resp->redirects) {
45 push @{$resp->{redirects
} ||= []}, $self->_munge_response($redirect, undef, 1);
49 my $content_ref = $ua_resp->content_ref;
51 if (($resp->{headers
}{'client-warning'} || '') eq 'Internal response') {
52 HTTP
::AnyUA
::Util
::internal_exception
($$content_ref, $resp);
55 $data_cb->($$content_ref, $resp);
58 $resp->{content
} = $$content_ref;
74 HTTP::AnyUA::Backend::LWP::UserAgent - A unified programming interface for LWP::UserAgent
82 This module adds support for the HTTP client L<LWP::UserAgent> to be used with the unified
83 programming interface provided by L<HTTP::AnyUA>.
91 L<HTTP::AnyUA::Backend>
97 Please report any bugs or feature requests on the bugtracker website
98 L<https://github.com/chazmcgarvey/HTTP-AnyUA/issues>
100 When submitting a bug or request, please include a test-file or a
101 patch to an existing test-file that illustrates the bug or desired
106 Charles McGarvey <chazmcgarvey@brokenzipper.com>
108 =head1 COPYRIGHT AND LICENSE
110 This software is copyright (c) 2017 by Charles McGarvey.
112 This is free software; you can redistribute it and/or modify it under
113 the same terms as the Perl 5 programming language system itself.
This page took 0.036967 seconds and 4 git commands to generate.