Debian Codegraph @

lib/WWW/ORCID/Transport/LWP.pm

raw symbols SCIP
1 package WWW::ORCID::Transport::LWPscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/;
2
3 use strictscip-perl cpan WWW-ORCID 0.0402 strict/;
4 use warningsscip-perl cpan WWW-ORCID 0.0402 warnings/;
5
6 our $VERSIONscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/$VERSION. = 0.0402;
7
8 use LWP::UserAgentscip-perl cpan WWW-ORCID 0.0402 LWP/UserAgent/ ();
9 use Mooscip-perl cpan WWW-ORCID 0.0402 Moo/;
10 use namespace::cleanscip-perl cpan WWW-ORCID 0.0402 namespace/clean/;
11
12 withscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/with(). 'WWW::ORCID::Transport';
13
14 hasscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/has(). _client =>
15 (is => 'ro', init_arg => 0, lazy => 1, builder => '_build_client',);
16
17 sub _build_clientscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_build_client(). {
18 LWP::UserAgent->newscip-perl cpan WWW-ORCID 0.0402 LWP/UserAgent/new().;
19 }
20
21 sub getscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/get(). {
22 my ($self, $url, $params, $headers) = @_scip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/`@_`.;
23 $url = $self->_param_urlscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_param_url().($url, $params) if $params;
24 my $res = $self->_clientscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_client().->getscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/get().($url, %$headers);
25 [$res->codescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/code()., $self->_get_headersscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_get_headers().($res), $res->contentscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/content().];
26 }
27
28 sub post_formscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/post_form(). {
29 my ($self, $url, $form, $headers) = @_scip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/`@_`.;
30 my $res = $self->_clientscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_client().->postscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/post().($url, $form, %$headers);
31 [$res->codescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/code()., $self->_get_headersscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_get_headers().($res), $res->contentscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/content().];
32 }
33
34 sub postscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/post(). {
35 my ($self, $url, $body, $headers) = @_scip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/`@_`.;
36 my $res = $self->_clientscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_client().->postscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/post().($url, %$headers, Content => $body);
37 [$res->codescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/code()., $self->_get_headersscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_get_headers().($res), $res->contentscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/content().];
38 }
39
40 sub putscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/put(). {
41 my ($self, $url, $body, $headers) = @_scip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/`@_`.;
42 my $res = $self->_clientscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_client().->putscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/put().($url, %$headers, Content => $body);
43 [$res->codescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/code()., $self->_get_headersscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_get_headers().($res), $res->contentscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/content().];
44 }
45
46 sub deletescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/delete(). {
47 my ($self, $url, $params, $headers) = @_scip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/`@_`.;
48 $url = $self->_param_urlscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_param_url().($url, $params) if $params;
49 my $res = $self->_clientscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_client().->deletescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/delete().($url, %$headers);
50 [$res->codescip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/code()., $self->_get_headersscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_get_headers().($res), $res->contentscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/content().];
51 }
52
53 sub _get_headersscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/_get_headers(). {
54 my ($self, $msg) = @_scip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/`@_`.;
55 my $headers = {};
56 for my $key ($msg->header_field_namesscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/header_field_names().) {
57 $headers->{lcscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/lc(). $key} = $msg->headerscip-perl cpan WWW-ORCID 0.0402 WWW/ORCID/Transport/LWP/header().($key);
58 }
59 $headers;
60 }
61
62 1;