blib/lib/Thunderhorse/Module/Middleware.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 85.7% 6 / 7 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 92.1% 35 / 38 CC 5 SCAR 11.7
CC
5
Cov
97%
build
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« blib/lib/Thunderhorse/Router/Location.pm ↑ Summary blib/lib/Test2/Thunderhorse.pm »
1 package Thunderhorse::Module::Middleware;
2 1 $Thunderhorse::Module::Middleware::VERSION = '0.107';
3 1 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Gears::X::Thunderhorse;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Gears qw(load_component get_component_name);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 extends 'Thunderhorse::Module';
10  
11 4 ▶sub build ($self)
Subroutine build: called CC=5 SCAR=16.1
Pod documented
12 {
13 4 weaken $self;
14 4 my %wrap = $self->config->%*;
15  
16 # NOTE: order must be reversed, because of LIFO
17 4 ▶ my @keys = reverse sort { ($wrap{$a}{_order} // 0) <=> ($wrap{$b}{_order} // 0) or $a cmp $b }
Condition85%6/7
($wrap{$a}{'_order'} // 0) <=> ($wrap{$b}{'_order'} // 0) || $a cmp $b
l!l&&r!l&&!r
530
$wrap{$a}{"_order"} // 0
l!l
53
$wrap{$b}{"_order"} // 0
l!l
44
MC/DC0%0/2
($wrap{$a}{'_order'} // 0) <=> ($wrap{$b}{'_order'} // 0) || $a cmp $b
$wrap{$a}{"_order"} $a cmp $b
MC/DC100%1/1
$wrap{$b}{"_order"} // 0
$wrap{$b}{"_order"}
Truth table66%2/3
A || B
A= $wrap{$a}{"_order"}B= $a cmp $b
ABresult
1X1
011
000
Truth table100%2/2
A
A= $wrap{$b}{"_order"}
Aresult
11
00
18 keys %wrap;
19  
20 4 foreach my $key (@keys) {
21 11 delete $wrap{$key}{_order};
22  
23 11 my $class = load_component(get_component_name($key, 'PAGI::Middleware'));
24 11 my $mw = $class->new($wrap{$key}->%*);
25 11 $self->add_middleware($mw);
26 }
27 }
28  
29 __END__
« blib/lib/Thunderhorse/Router/Location.pm ↑ Summary blib/lib/Test2/Thunderhorse.pm »