line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Pua; |
2
|
2
|
|
|
2
|
|
295181
|
use Mojo::Base 'Mojo::UserAgent'; |
|
2
|
|
|
|
|
8308
|
|
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
170332
|
use Evo 'Evo::Export; Mojo::Promise *; Carp croak; Mojo::Pua::Error'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.006'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# LIB version |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
164
|
use constant SINGLE => our $SINGLE = __PACKAGE__->new(max_connections => 100); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
30
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
1
|
225
|
sub pua_delete(@opts) : Export { SINGLE()->delete(@_) } |
|
2
|
|
|
1
|
|
2
|
|
|
2
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
12
|
2
|
|
|
2
|
1
|
686
|
sub pua_get(@opts) : Export { SINGLE()->get(@_) } |
|
2
|
|
|
1
|
|
4
|
|
|
2
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
668
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
13
|
2
|
|
|
2
|
1
|
449
|
sub pua_head(@opts) : Export { SINGLE()->head(@_) } |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
288
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
14
|
2
|
|
|
2
|
1
|
503
|
sub pua_options(@opts) : Export { SINGLE()->options(@_) } |
|
2
|
|
|
1
|
|
2
|
|
|
2
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
282
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
15
|
2
|
|
|
2
|
1
|
456
|
sub pua_patch(@opts) : Export { SINGLE()->patch(@_) } |
|
2
|
|
|
1
|
|
2
|
|
|
2
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
278
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
16
|
2
|
|
|
2
|
1
|
444
|
sub pua_post(@opts) : Export { SINGLE()->post(@_) } |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
343
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
17
|
2
|
|
|
2
|
1
|
439
|
sub pua_put(@opts) : Export { SINGLE()->put(@_) } |
|
2
|
|
|
1
|
|
2
|
|
|
2
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
279
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# OO version |
20
|
12
|
50
|
|
12
|
1
|
8911
|
sub start ($self, $tx, $cb_empty = undef) { |
|
12
|
50
|
|
|
|
41
|
|
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
12
|
|
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
12
|
|
21
|
|
|
|
|
|
|
|
22
|
12
|
100
|
|
|
|
231
|
croak "Got callback but this class returns a Promise" if $cb_empty; |
23
|
11
|
|
|
|
|
28
|
my $d = deferred(); |
24
|
|
|
|
|
|
|
|
25
|
11
|
50
|
|
4
|
|
15034
|
my $pcb = sub ($ua, $tx) { |
|
11
|
50
|
|
|
|
2591
|
|
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
3
|
|
26
|
4
|
|
|
|
|
13
|
my $res = $tx->success; |
27
|
4
|
100
|
|
|
|
58
|
return $d->resolve($res) if $res; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
3
|
my $err = $tx->error; |
30
|
|
|
|
|
|
|
my $perr = Mojo::Pua::Error->new( |
31
|
|
|
|
|
|
|
res => $tx->res, |
32
|
|
|
|
|
|
|
message => $err->{message}, |
33
|
|
|
|
|
|
|
code => $err->{code} |
34
|
1
|
|
|
|
|
9
|
); |
35
|
1
|
|
|
|
|
37
|
$d->reject($perr); |
36
|
11
|
|
|
|
|
686
|
}; |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
16
|
$self->SUPER::start($tx, $pcb); |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
2573
|
$d->promise; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# ABSTRACT: HTTP Client + Evo::Promises |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |