line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Pua; |
2
|
2
|
|
|
2
|
|
291752
|
use Mojo::Base 'Mojo::UserAgent'; |
|
2
|
|
|
|
|
7319
|
|
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
158086
|
use Evo 'Evo::Export; Mojo::Promise *; Carp croak; Mojo::Pua::Error'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.007'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# LIB version |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
121
|
use constant PUA => __PACKAGE__->new(); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
26
|
|
10
|
|
|
|
|
|
|
export 'PUA'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# OO version |
13
|
6
|
50
|
|
6
|
1
|
7092
|
sub start ($self, $tx, $cb_empty = undef) { |
|
6
|
50
|
|
|
|
10
|
|
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
6
|
100
|
|
|
|
199
|
croak "Got callback but this class returns a Promise" if $cb_empty; |
16
|
5
|
|
|
|
|
14
|
my $d = deferred(); |
17
|
|
|
|
|
|
|
|
18
|
5
|
50
|
|
4
|
|
14691
|
my $pcb = sub ($ua, $tx) { |
|
5
|
50
|
|
|
|
567
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
1
|
|
19
|
4
|
|
|
|
|
11
|
my $res = $tx->success; |
20
|
4
|
100
|
|
|
|
58
|
return $d->resolve($res) if $res; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
my $err = $tx->error; |
23
|
|
|
|
|
|
|
my $perr = Mojo::Pua::Error->new( |
24
|
|
|
|
|
|
|
res => $tx->res, |
25
|
|
|
|
|
|
|
message => $err->{message}, |
26
|
|
|
|
|
|
|
code => $err->{code} |
27
|
1
|
|
|
|
|
10
|
); |
28
|
1
|
|
|
|
|
33
|
$d->reject($perr); |
29
|
5
|
|
|
|
|
316
|
}; |
30
|
|
|
|
|
|
|
|
31
|
4
|
|
|
|
|
14
|
$self->SUPER::start($tx, $pcb); |
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
2472
|
$d->promise; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# ABSTRACT: HTTP Client + Evo::Promises |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |