line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::HTTP::Spore::Middleware; |
2
|
|
|
|
|
|
|
$Net::HTTP::Spore::Middleware::VERSION = '0.08'; |
3
|
|
|
|
|
|
|
# ABSTRACT: middlewares base class |
4
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
9558
|
use strict; |
|
19
|
|
|
|
|
216
|
|
|
19
|
|
|
|
|
599
|
|
6
|
19
|
|
|
19
|
|
95
|
use warnings; |
|
19
|
|
|
|
|
36
|
|
|
19
|
|
|
|
|
504
|
|
7
|
19
|
|
|
19
|
|
88
|
use Scalar::Util; |
|
19
|
|
|
|
|
34
|
|
|
19
|
|
|
|
|
3757
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
39
|
|
|
39
|
0
|
95
|
my $class = shift; |
11
|
39
|
|
|
|
|
152
|
bless {@_}, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub response_cb { |
15
|
9
|
|
|
9
|
0
|
50
|
my ($self, $cb) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $body_filter = sub { |
18
|
9
|
|
|
9
|
|
40
|
my $filter = $cb->(@_); |
19
|
9
|
|
|
|
|
55
|
}; |
20
|
9
|
|
|
|
|
61
|
return $body_filter; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub wrap { |
24
|
41
|
|
|
41
|
0
|
153
|
my ($self, $cond, @args) = @_; |
25
|
|
|
|
|
|
|
|
26
|
41
|
100
|
|
|
|
190
|
if (!Scalar::Util::blessed($self)) { |
27
|
39
|
|
|
|
|
190
|
$self = $self->new(@args); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return sub { |
31
|
45
|
|
|
45
|
|
103
|
my $request = shift; |
32
|
45
|
100
|
|
|
|
178
|
if ($cond->($request)) { |
33
|
44
|
|
|
|
|
279
|
$self->call($request, @_); |
34
|
|
|
|
|
|
|
} |
35
|
41
|
|
|
|
|
234
|
}; |
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.08 |
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 |