|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Mojo::Pua;  | 
| 
2
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
1112697
 | 
 use Mojo::Base 'Mojo::UserAgent';  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15682
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
43
 | 
    | 
| 
3
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
366893
 | 
 use Evo 'Evo::Export; -Promise::Mojo *; Carp croak';  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
58
 | 
    | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '0.010';    # VERSION  | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # LIB version  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
243
 | 
 use constant PUA => __PACKAGE__->new();  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
60
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 export 'PUA';  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # OO version  | 
| 
13
 | 
12
 | 
  
 50
  
 | 
 
 | 
  
12
  
 | 
  
1
  
 | 
27494
 | 
 sub start ($self, $tx, $cb_empty = undef) {  | 
| 
 
 | 
12
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
48
 | 
    | 
| 
 
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
 
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
    | 
| 
 
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
 
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
    | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
15
 | 
12
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
370
 | 
   croak "Got callback but this class returns a Promise" if $cb_empty;  | 
| 
16
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
51
 | 
   my $d = deferred();  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
18
 | 
11
 | 
  
 50
  
 | 
 
 | 
  
11
  
 | 
 
 | 
133842
 | 
   my $pcb = sub ($ua, $tx) {  | 
| 
 
 | 
11
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
49
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
    | 
| 
19
 | 
11
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
46
 | 
     return $d->resolve($tx) if $tx->res->code;  | 
| 
20
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
40
 | 
     $d->reject($tx->error->{message});  | 
| 
21
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1096
 | 
   };  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
23
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
80
 | 
   $self->SUPER::start($tx, $pcb);  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
25
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11238
 | 
   $d->promise;  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
28
 | 
6
 | 
  
 50
  
 | 
 
 | 
  
6
  
 | 
  
1
  
 | 
72
 | 
 sub want_code($want_code) : prototype($) : Export {  | 
| 
 
 | 
6
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
23
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
29
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
32
 | 
   my (undef, $file, $line) = caller();  | 
| 
30
 | 
4
 | 
  
 50
  
 | 
 
 | 
  
4
  
 | 
 
 | 
1432
 | 
   return sub($tx) {  | 
| 
 
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
13
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
31
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     my $res = $tx->res;  | 
| 
32
 | 
4
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
23
 | 
     return $res if $res->code == $want_code;  | 
| 
33
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
     die  | 
| 
34
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
       "Wanted [$want_code], got [${\$res->code}] ${\$res->message} at $file line $line\n";  | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
    | 
| 
35
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
67
 | 
   };  | 
| 
36
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
1400
 | 
 }  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
    | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: HTTP Client + Evo::Promise  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |