line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Middleware::Conditional; |
2
|
30
|
|
|
30
|
|
208
|
use strict; |
|
30
|
|
|
|
|
63
|
|
|
30
|
|
|
|
|
1021
|
|
3
|
30
|
|
|
30
|
|
162
|
use parent qw(Plack::Middleware); |
|
30
|
|
|
|
|
54
|
|
|
30
|
|
|
|
|
168
|
|
4
|
|
|
|
|
|
|
|
5
|
30
|
|
|
30
|
|
1500
|
use Plack::Util::Accessor qw( condition middleware builder ); |
|
30
|
|
|
|
|
59
|
|
|
30
|
|
|
|
|
113
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub prepare_app { |
8
|
5
|
|
|
5
|
1
|
9
|
my $self = shift; |
9
|
5
|
|
|
|
|
25
|
$self->middleware( $self->builder->($self->app) ); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub call { |
13
|
13
|
|
|
13
|
1
|
29
|
my($self, $env) = @_; |
14
|
|
|
|
|
|
|
|
15
|
13
|
100
|
|
|
|
42
|
my $app = $self->condition->($env) ? $self->middleware : $self->app; |
16
|
13
|
|
|
|
|
43
|
return $app->($env); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |