line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::HTTP::Spore::Middleware; |
2
|
|
|
|
|
|
|
$Net::HTTP::Spore::Middleware::VERSION = '0.07'; |
3
|
|
|
|
|
|
|
# ABSTRACT: middlewares base class |
4
|
|
|
|
|
|
|
|
5
|
18
|
|
|
18
|
|
8684
|
use strict; |
|
18
|
|
|
|
|
75
|
|
|
18
|
|
|
|
|
651
|
|
6
|
18
|
|
|
18
|
|
144
|
use warnings; |
|
18
|
|
|
|
|
167
|
|
|
18
|
|
|
|
|
540
|
|
7
|
18
|
|
|
18
|
|
103
|
use Scalar::Util; |
|
18
|
|
|
|
|
31
|
|
|
18
|
|
|
|
|
3743
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
37
|
|
|
37
|
0
|
78
|
my $class = shift; |
11
|
37
|
|
|
|
|
129
|
bless {@_}, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub response_cb { |
15
|
7
|
|
|
7
|
0
|
34
|
my ($self, $cb) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $body_filter = sub { |
18
|
7
|
|
|
7
|
|
23
|
my $filter = $cb->(@_); |
19
|
7
|
|
|
|
|
34
|
}; |
20
|
7
|
|
|
|
|
43
|
return $body_filter; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub wrap { |
24
|
39
|
|
|
39
|
0
|
129
|
my ($self, $cond, @args) = @_; |
25
|
|
|
|
|
|
|
|
26
|
39
|
100
|
|
|
|
164
|
if (!Scalar::Util::blessed($self)) { |
27
|
37
|
|
|
|
|
155
|
$self = $self->new(@args); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return sub { |
31
|
41
|
|
|
41
|
|
84
|
my $request = shift; |
32
|
41
|
100
|
|
|
|
176
|
if ($cond->($request)) { |
33
|
40
|
|
|
|
|
235
|
$self->call($request, @_); |
34
|
|
|
|
|
|
|
} |
35
|
39
|
|
|
|
|
206
|
}; |
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.07 |
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 |