FindApp/Object/Behavior/Shortcuts.pm

filter: Statementstmt 67.6% 121 / 179 Branchbran 64.2% 27 / 42 Conditioncond 44.1% 15 / 34 MC/DCmcdc 9.0% 2 / 22 Subroutinesub 43.7% 14 / 32 Podpod n/a totaltotal 57.9% 179 / 309 CC 46 SCAR 9.9
CC
46
Cov
64%
__ANON__
4.3
add_mandirs_allowed
4.3
add_mandirs_wanted
4.3
CRAP 2.7
« FindApp/Object/Behavior/Loader.pm ↑ Summary FindApp/Object/State.pm »
1 package FindApp::Object::Behavior::Shortcuts;
2  
3 6 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use mro "c3";
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶use FindApp::Vars qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use FindApp::Utils qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 my @_SUBDIRS = +BLM;
14 2 my @_ALLDIRS = (root => @_SUBDIRS);
15  
16 2 for my $DIR (@_ALLDIRS) {
17 # BUILD: export_bin_to_env
18 # BUIOD: export_lib_to_env
19 # BUIOD: export_man_to_env
20 # BUIOD: export_root_to_env
21 0 ▶ function "export_${DIR}_to_env" => sub { &ENTER_TRACE;
Subroutine export_bin_to_env: not called CC=1 SCAR=0.6
Subroutine export_lib_to_env: called CC=1 SCAR=0.6
Subroutine export_man_to_env: called CC=1 SCAR=0.6
Subroutine __ANON__: not called CC=1 SCAR=0.6
22 0 my $self = &myself;
23 0 good_args(@_ == 0);
24 0 $self->group($DIR)->export_to_env;
25 8 };
26 # BUILD: bindirs libdirs mandirs rootdirs
27 21 ▶ function "${DIR}dirs" => sub {
Subroutine rootdirs: called CC=2 SCAR=7.6
Subroutine libdirs: called CC=2 SCAR=7.6
Subroutine bindirs: called CC=2 SCAR=7.6
Subroutine mandirs: not called CC=2 SCAR=7.6
28 0 my $self = &myself;
29 0 good_args(@_ == 0);
30 0 my $group = $self->group($DIR);
31 0 ▶ return wantarray ? $group->found : $group;
Branch: 6 branches
BranchTrueFalseTotal
wantarray ? : 4 17 21
wantarray ? : 4 10 14
wantarray ? : 14 6 20
wantarray ? : 11 17 28
wantarray ? : 0 0 0
wantarray ? : 0 0 0
32 8 };
33 8 *rootdir = *rootdir = \&rootdirs;
34  
35 8 my $is_pl = $DIR ne "root";
36 8 ▶ my $NAMEDIR = $DIR . "dir" . ($is_pl && "s");
Condition100%2/2
$is_pl && 's'
!ll
26
MC/DC100%1/1
$is_pl && 's'
$is_pl
Truth table100%2/2
A
A= $is_pl
Aresult
00
11
37 8 ▶ my $has_have = $is_pl ? "have" : "has";
Branch: 1 branch
BranchTrueFalseTotal
$is_pl ? : 6 2 8
38 8 ▶ my $is_are = $is_pl ? "are" : "is";
Branch: 1 branch
BranchTrueFalseTotal
$is_pl ? : 6 2 8
39  
40 8 my %access_verb = (
41 wanted => $has_have,
42 allowed => $is_are,
43 );
44  
45 8 ▶ while (my($ACCESSOR, $VERB) = each %access_verb) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %access_verb) 16 8 24
46 0 ▶ function $NAMEDIR . "_" . $VERB => sub {
Subroutine rootdir_is: not called CC=2 SCAR=9.2
Subroutine rootdir_has: not called CC=2 SCAR=9.2
Subroutine libdirs_have: not called CC=2 SCAR=9.2
Subroutine libdirs_are: not called CC=2 SCAR=9.2
Subroutine bindirs_are: not called CC=2 SCAR=9.2
47 0 my $self = &myself;
48 0 ▶ my $action = join("_" => (@_ ? "set" : "get"), $NAMEDIR, $ACCESSOR);
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
@_ ? : 3 1 4
@_ ? : 6 2 8
@_ ? : 3 1 4
@_ ? : 0 0 0
@_ ? : 0 0 0
49 0 $self->$action(@_);
50 16 };
51 }
52  
53 } ## for my @DIR (@_ALLDIRS)
54  
55 2 my @ACCESSORS = qw(allowed found wanted);
56  
57 2 for my $TYPE (@ACCESSORS) {
58 # BUILD: allowed found wanted
59 0 ▶ function $TYPE => sub {
Subroutine allowed: not called CC=1 SCAR=0.6
Subroutine found: not called CC=1 SCAR=0.6
Subroutine wanted: not called CC=1 SCAR=0.6
60 0 my $self = &myself;
61 0 good_args(@_ == 1);
62 0 my $dir = shift;
63 0 return $self->group($dir)->$TYPE;
64 6 };
65  
66 6 for my $DIR (@_ALLDIRS) {
67 24 my $is_pl = $DIR ne "root";
68 24 ▶ my $NAMEDIR = $DIR . "dir" . ($is_pl && "s");
Condition100%2/2
$is_pl && 's'
!ll
618
MC/DC100%1/1
$is_pl && 's'
$is_pl
Truth table100%2/2
A
A= $is_pl
Aresult
00
11
69  
70 24 my $ACTION = $NAMEDIR . "_" . $TYPE;
71  
72 # BUILD: <{rootdir,{bin,lib,man}dirs}_{allowed,found,wanted}>
73 # BUILD: rootdir_allowed rootdir_found rootdir_wanted
74 # BUILD: bindirs_allowed bindirs_found bindirs_wanted
75 # BUILD: libdirs_allowed libdirs_found libdirs_wanted
76 # BUILD: mandirs_allowed mandirs_found mandirs_wanted
77 0 ▶ function $ACTION => sub {
Subroutine bindirs_found: not called CC=1 SCAR=1.3
Subroutine rootdir_wanted: not called CC=1 SCAR=1.3
Subroutine bindirs_allowed: not called CC=1 SCAR=1.3
Subroutine __ANON__: not called CC=1 SCAR=1.3
Subroutine libdirs_found: not called CC=1 SCAR=1.3
78 0 my $self = &myself;
79 0 good_args(@_ == 0);
80 0 return $self->group($DIR)->$TYPE;
81 24 };
82  
83 24 for my $OP (qw(add get set)) {
84 72 my $FUNC_NAME = "${OP}_${ACTION}";
85 # BUILD: <{add,get,set}_{rootdir,{bin,lib,man}dirs}_{allowed,found,wanted}>
86 # BUILD: add_rootdir_allowed add_rootdir_found add_rootdir_wanted
87 # BUILD: add_bindirs_allowed add_bindirs_found add_bindirs_wanted
88 # BUILD: add_libdirs_allowed add_libdirs_found add_libdirs_wanted
89 # BUILD: add_mandirs_allowed add_mandirs_found add_mandirs_wanted
90 # BUILD: get_rootdir_allowed get_rootdir_found get_rootdir_wanted
91 # BUILD: get_bindirs_allowed get_bindirs_found get_bindirs_wanted
92 # BUILD: get_libdirs_allowed get_libdirs_found get_libdirs_wanted
93 # BUILD: get_mandirs_allowed get_mandirs_found get_mandirs_wanted
94 # BUILD: set_rootdir_allowed set_rootdir_found set_rootdir_wanted
95 # BUILD: set_bindirs_allowed set_bindirs_found set_bindirs_wanted
96 # BUILD: set_libdirs_allowed set_libdirs_found set_libdirs_wanted
97 # BUILD: set_mandirs_allowed set_mandirs_found set_mandirs_wanted
98 2 ▶ function $FUNC_NAME => sub {
Subroutine __ANON__: called CC=3 SCAR=14.6
Subroutine get_mandirs_wanted: called CC=3 SCAR=14.6
Subroutine add_mandirs_allowed: not called CC=3 SCAR=14.6
Subroutine get_bindirs_found: not called CC=3 SCAR=14.6
99 0 my $self = &myself;
100 0 ▶ croak("$FUNC_NAME: no args allowed") if @_ && $OP eq "get";
Branch: 6 branches
BranchTrueFalseTotal
if @_ and $OP eq "get" 0 2 2
if @_ and $OP eq "get" 3 1 4
if @_ and $OP eq "get" 16 11 27
if @_ and $OP eq "get" 8 4 12
if @_ and $OP eq "get" 0 0 0
if @_ and $OP eq "get" 0 0 0
Condition36%11/30
@_ and $OP eq "get"
!ll&&!rl&&r
020
@_ and $OP eq "get"
!ll&&!rl&&r
030
@_ and $OP eq "get"
!ll&&!rl&&r
390
@_ and $OP eq "get"
!ll&&!rl&&r
9270
@_ and $OP eq "get"
!ll&&!rl&&r
030
@_ and $OP eq "get"
!ll&&!rl&&r
130
@_ and $OP eq "get"
!ll&&!rl&&r
390
@_ and $OP eq "get"
!ll&&!rl&&r
000
@_ and $OP eq "get"
!ll&&!rl&&r
000
@_ and $OP eq "get"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
MC/DC0%0/2
@_ and $OP eq "get"
@_ $OP eq "get"
Truth table33%1/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table33%1/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table33%1/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @_B= $OP eq "get"
ABresult
0X0
100
111
101 0 return $self->group($DIR)->$TYPE->$OP(@_);
102 72 };
103 } ## for my $OP (qw(add get set))
104  
105 } ## for my @DIR (@_ALLDIRS)
106 } ## for my $TYPE (@ACCESSORS)
107  
108 2 1;
109  
110 __END__
« FindApp/Object/Behavior/Loader.pm ↑ Summary FindApp/Object/State.pm »