File Coverage

blib/lib/Kelp/Module/Symbiosis/_Util.pm
Criterion Covered Total %
statement 24 24 100.0
branch 1 2 50.0
condition 3 5 60.0
subroutine 5 5 100.0
pod 0 2 0.0
total 33 38 86.8


line stmt bran cond sub pod time code
1             $Kelp::Module::Symbiosis::_Util::VERSION = '1.13';
2             use v5.10;
3 6     6   81 use warnings;
  6         18  
4 6     6   28 use Plack::Util;
  6         55  
  6         158  
5 6     6   70  
  6         13  
  6         1266  
6             {
7             my ($self, $app) = @_;
8              
9 47     47 0 759 for (@{$self->middleware}) {
10             my ($class, $args) = @$_;
11 47         68  
  47         114  
12 8         49 # Same middleware loading procedure as Kelp
13             next if $self->{_loaded_middleware}{$class}++ && !$ENV{KELP_TESTING};
14              
15 8 50 66     37 my $mw = Plack::Util::load_class($class, "Plack::Middleware");
16             $app = $mw->wrap($app, %{$args // {}});
17 8         21 }
18 8   50     2122  
  8         77  
19             return $app;
20             }
21 47         488  
22             {
23             my ($self, %args) = @_;
24              
25             my $middleware = $self->middleware;
26 14     14 0 28 foreach my $mw (@{$args{middleware}}) {
27             my $config = $args{middleware_init}{$mw};
28 14         49 push @$middleware, [$mw, $config];
29 14         24 }
  14         32  
30 3         7  
31 3         8 return;
32             }
33              
34 14         36 1;
35