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
|
|
1364
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
93
|
|
6
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
988
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.904'; # 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
|
6
|
my $class = shift; |
17
|
4
|
50
|
|
|
|
10
|
my $backend = shift or die 'Backend is required'; |
18
|
4
|
|
|
|
|
11
|
my $self = bless {backend => $backend}, $class; |
19
|
4
|
|
|
|
|
29
|
$self->init(@_); |
20
|
4
|
|
|
|
|
8
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
2
|
1
|
|
sub init {} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub wrap { |
28
|
4
|
|
|
4
|
1
|
9
|
my $self = shift; |
29
|
4
|
50
|
|
|
|
16
|
my $backend = shift or _usage($self . q{->wrap($backend, %args)}); |
30
|
|
|
|
|
|
|
|
31
|
4
|
50
|
|
|
|
11
|
if (ref $self) { |
32
|
0
|
|
|
|
|
0
|
$self->{backend} = $backend; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
4
|
|
|
|
|
18
|
$self = $self->new($backend, @_); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
16
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
0
|
sub request { shift->backend->request(@_) } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
27
|
|
|
27
|
1
|
73
|
sub backend { shift->{backend} } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
1
|
0
|
sub ua { shift->backend->ua(@_) } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
19
|
|
|
19
|
1
|
42
|
sub response_is_future { shift->backend->response_is_future(@_) } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |