line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::HTTP::Spore::Middleware; |
2
|
|
|
|
|
|
|
$Net::HTTP::Spore::Middleware::VERSION = '0.09'; |
3
|
|
|
|
|
|
|
# ABSTRACT: middlewares base class |
4
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
9061
|
use strict; |
|
19
|
|
|
|
|
184
|
|
|
19
|
|
|
|
|
620
|
|
6
|
19
|
|
|
19
|
|
134
|
use warnings; |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
549
|
|
7
|
19
|
|
|
19
|
|
99
|
use Scalar::Util; |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
3778
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
39
|
|
|
39
|
0
|
93
|
my $class = shift; |
11
|
39
|
|
|
|
|
140
|
bless {@_}, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub response_cb { |
15
|
9
|
|
|
9
|
0
|
61
|
my ($self, $cb) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $body_filter = sub { |
18
|
9
|
|
|
9
|
|
34
|
my $filter = $cb->(@_); |
19
|
9
|
|
|
|
|
38
|
}; |
20
|
9
|
|
|
|
|
57
|
return $body_filter; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub wrap { |
24
|
41
|
|
|
41
|
0
|
153
|
my ($self, $cond, @args) = @_; |
25
|
|
|
|
|
|
|
|
26
|
41
|
100
|
|
|
|
185
|
if (!Scalar::Util::blessed($self)) { |
27
|
39
|
|
|
|
|
187
|
$self = $self->new(@args); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return sub { |
31
|
45
|
|
|
45
|
|
87
|
my $request = shift; |
32
|
45
|
100
|
|
|
|
165
|
if ($cond->($request)) { |
33
|
44
|
|
|
|
|
263
|
$self->call($request, @_); |
34
|
|
|
|
|
|
|
} |
35
|
41
|
|
|
|
|
259
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Net::HTTP::Spore::Middleware - middlewares base class |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 0.09 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHORS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 4 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Franck Cuny <franck.cuny@gmail.com> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Ash Berlin <ash@cpan.org> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Ahmad Fatoum <athreef@cpan.org> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Linkfluence. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
77
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |