line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::ORCID::Transport::HTTP::Tiny; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
74133
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.0402; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
562
|
use Moo; |
|
1
|
|
|
|
|
11721
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
2329
|
use HTTP::Tiny; |
|
1
|
|
|
|
|
51541
|
|
|
1
|
|
|
|
|
48
|
|
10
|
1
|
|
|
1
|
|
492
|
use namespace::clean; |
|
1
|
|
|
|
|
11866
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'WWW::ORCID::Transport'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has _client => |
15
|
|
|
|
|
|
|
(is => 'ro', init_arg => 0, lazy => 1, builder => '_build_client',); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _build_client { |
18
|
0
|
|
|
0
|
|
|
HTTP::Tiny->new; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get { |
22
|
|
|
|
|
|
|
my ($self, $url, $params, $headers) = @_; |
23
|
|
|
|
|
|
|
if ($params) { |
24
|
|
|
|
|
|
|
$url = $self->_param_url($url, $params); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
my $res = $self->_client->get($url, {headers => $headers}); |
27
|
|
|
|
|
|
|
[$res->{status}, $res->{headers}, $res->{content}]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub post_form { |
31
|
|
|
|
|
|
|
my ($self, $url, $form, $headers) = @_; |
32
|
|
|
|
|
|
|
my $res = $self->_client->post_form($url, $form, {headers => $headers}); |
33
|
|
|
|
|
|
|
[$res->{status}, $res->{headers}, $res->{content}]; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub post { |
37
|
|
|
|
|
|
|
my ($self, $url, $body, $headers) = @_; |
38
|
|
|
|
|
|
|
my $res |
39
|
|
|
|
|
|
|
= $self->_client->post($url, {content => $body, headers => $headers}); |
40
|
|
|
|
|
|
|
[$res->{status}, $res->{headers}, $res->{content}]; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub put { |
44
|
|
|
|
|
|
|
die 'TODO'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub delete { |
48
|
|
|
|
|
|
|
die 'TODO'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |