Catmandu/Pluggable.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 50.0% 3 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 76.6% 36 / 47 CC 6 SCAR 15.1
CC
6
Cov
81%
with_plugins
6.9
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
« Catmandu/Exporter/JSON.pm ↑ Summary Catmandu/Fix/sleep.pm »
1 package Catmandu::Pluggable;
2  
3 21 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 21 our $VERSION = '1.2025';
6  
7 21 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 21 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 ▶sub plugin_namespace {'Catmandu::Plugin'}
Subroutine plugin_namespace: called CC=1 SCAR=0.0
Pod documented
11  
12 15 ▶sub with_plugins {
Subroutine with_plugins: called CC=6 SCAR=19.3
Pod documented
13 15 my $class = shift;
14 15 ▶ $class = ref $class || $class;
Condition66%2/3
ref $class || $class
l!l&&r!l&&!r
1140
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table66%2/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
15 0 ▶ my @plugins = ref $_[0] eq 'ARRAY' ? @{$_[0]} : @_;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 15 15
16 15 @plugins = split /,/, join ',', @plugins;
17 15 ▶ @plugins || return $class;
Branch: 1 branch
BranchTrueFalseTotal
@plugins or return $class 15 0 15
18 15 my $ns = $class->plugin_namespace;
19 Moo::Role->create_class_with_roles(
20 $class,
21 map {
22 15 my $pkg = $_;
23 16 ▶ if ($pkg !~ s/^\+// && $pkg !~ /^$ns/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pkg =~ s/^\+// or $pkg =~ /^$ns/) 16 0 16
Condition33%1/3
$pkg =~ s/^\+// or $pkg =~ /^$ns/
l!l&&r!l&&!r
0016
MC/DC0%0/2
$pkg =~ s/^\+// or $pkg =~ /^$ns/
$pkg =~ s/^\+// $pkg =~ /^$ns/
Truth table33%1/3
A or B
A= $pkg =~ s/^\+//B= $pkg =~ /^$ns/
ABresult
1X1
011
000
24 16 $pkg = "${ns}::${pkg}";
25 }
26 16 $pkg;
27 } @plugins
28 );
29 }
30  
31 21 1;
32  
33 __END__
« Catmandu/Exporter/JSON.pm ↑ Summary Catmandu/Fix/sleep.pm »