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.14';
2             use v5.10;
3 6     6   72 use warnings;
  6         16  
4 6     6   27 use Plack::Util;
  6         39  
  6         145  
5 6     6   65  
  6         12  
  6         1185  
6             {
7             my ($self, $app) = @_;
8              
9 47     47 0 696 for (@{$self->middleware}) {
10             my ($class, $args) = @$_;
11 47         51  
  47         106  
12 8         50 # Same middleware loading procedure as Kelp
13             next if $self->{_loaded_middleware}{$class}++ && !$ENV{KELP_TESTING};
14              
15 8 50 66     80 my $mw = Plack::Util::load_class($class, "Plack::Middleware");
16             $app = $mw->wrap($app, %{$args // {}});
17 8         38 }
18 8   50     2506  
  8         83  
19             return $app;
20             }
21 47         487  
22             {
23             my ($self, %args) = @_;
24              
25             my $middleware = $self->middleware;
26 14     14 0 31 foreach my $mw (@{$args{middleware}}) {
27             my $config = $args{middleware_init}{$mw};
28 14         45 push @$middleware, [$mw, $config];
29 14         23 }
  14         33  
30 3         6  
31 3         8 return;
32             }
33              
34 14         36 1;
35