line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::AnyUA::Middleware; |
2
|
|
|
|
|
|
|
# ABSTRACT: A base class for HTTP::AnyUA middleware |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
1266
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
93
|
|
6
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
999
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.902'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
|
0
|
sub _croak { require Carp; Carp::croak(@_) } |
|
0
|
|
|
|
|
0
|
|
11
|
0
|
|
|
0
|
|
0
|
sub _usage { _croak("Usage: @_\n") } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
4
|
|
|
4
|
1
|
7
|
my $class = shift; |
17
|
4
|
50
|
|
|
|
11
|
my $backend = shift or die 'Backend is required'; |
18
|
4
|
|
|
|
|
12
|
my $self = bless {backend => $backend}, $class; |
19
|
4
|
|
|
|
|
30
|
$self->init(@_); |
20
|
4
|
|
|
|
|
9
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
2
|
1
|
|
sub init {} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub wrap { |
28
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
29
|
4
|
50
|
|
|
|
14
|
my $backend = shift or _usage($self . q{->wrap($backend, %args)}); |
30
|
|
|
|
|
|
|
|
31
|
4
|
50
|
|
|
|
13
|
if (ref $self) { |
32
|
0
|
|
|
|
|
0
|
$self->{backend} = $backend; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
4
|
|
|
|
|
21
|
$self = $self->new($backend, @_); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
14
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
0
|
sub request { shift->backend->request(@_) } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
12
|
|
|
12
|
1
|
42
|
sub backend { shift->{backend} } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
1
|
0
|
sub ua { shift->backend->ua(@_) } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
5
|
|
|
5
|
1
|
19
|
sub response_is_future { shift->backend->response_is_future(@_) } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |