lib/FindApp/Object/Behavior/Devperl.pm

filter: Statementstmt 83.1% 94 / 113 Branchbran 37.5% 6 / 16 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 79.3% 23 / 29 Podpod 100% 15 / 15 totaltotal 78.2% 140 / 179 CC 13 SCAR 20.4
CC
13
Cov
77%
use_my_devperl
42.0
findapp_root_from_path
4.0
some_devperl_dir
3.1
CRAP 7.7
« blib/lib/FindApp/Utils/Package/Object.pm ↑ Summary lib/FindApp/Object/Behavior.pm »
1 package FindApp::Object::Behavior::Devperl;
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 Config qw( %Config );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use FindApp::Vars qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use FindApp::Utils qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 ▶{ my $iota; BEGIN { $iota = 0 } use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 DEVPERL__MIN => $iota - 0, # need expr so compiler doesn't over-optimize
14 DEVPERL_NONE => $iota ++ ,
15 DEVPERL_SOME => $iota ++ ,
16 DEVPERL_ALL => $iota ++ ,
17 DEVPERL__MAX => $iota - 1,
18 6 ▶ };
Subroutine BEGIN: called CC=1 SCAR=0.0
19 }
20  
21 6 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 ################################################################
24  
25 # Declare attributes. These can normally be cleaned,
26 # including here, but since we haven't cleaned the others,
27 # might was well leave it.
28 6 use pluskeys qw(
29 WHICH_DEVPERLS
30 6 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 14 ▶sub init { &ENTER_TRACE;
Subroutine init: called CC=1 SCAR=0.0
Pod documented
33 14 my($self) = @_;
34 14 $self->maybe::next::method;
35 14 $self->use_some_devperls;
36 }
37  
38 9 ▶sub copy { &ENTER_TRACE;
Subroutine copy: called CC=2 SCAR=7.0
Pod documented
39 9 my($to, $from) = @_;
40 9 $to->next::method($from);
41 9 ▶ $to->forgotten_devperls($from->forgotten_devperls)
Branch: 1 branch
BranchTrueFalseTotal
if $from->can("forgotten_devperls") 9 0 9
42 if $from->can("forgotten_devperls");
43 9 return $to;
44 }
45  
46 4 ▶sub findapp_root_from_path { &ENTER_TRACE;
Subroutine findapp_root_from_path: called CC=4 SCAR=13.9
Pod documented
47 4 my $self = &myself;
48 4 my($path) = @_;
49 4 good_args($path);
50 4 ▶ my $root = $self->next::method($path) || return;
Condition50%1/2
$self->next::method($path) || (return)
l!l
40
MC/DC0%0/1
$self->next::method($path) || (return)
$self->next::method($path)
Truth table50%1/2
A
A= $self->next::method($path)
Aresult
11
00
51 4 for my $dir ($self->subgroup_names) {
52 12 ▶ if (my @extra = $self->some_devperl_dir($dir)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@extra) = $self->some_devperl_dir($dir)) 4 8 12
53 4 $self->group($dir)->found->add(@extra);
54 }
55 }
56 4 return $root;
57 }
58  
59 ################################################################
60  
61 0 ▶sub use_my_devperl { &ENTER_TRACE;
Subroutine use_my_devperl: not called CC=6 SCAR=37.4
Pod documented
62 0 my $self = &myself;
63 0 bad_args(@_ > 1);
64 SWITCH:
65 0 ▶ for (@_ ? @_ : "some") {
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
66 0 ▶ /^ no (ne)? $/x && case { $self->use_no_devperls };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
/^ no (ne)? $/x and &case(sub { $self->use_no_devperls; } ) 0 0 0
67 0 ▶ /^ some $/x && case { $self->use_some_devperls };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
/^ some $/x and &case(sub { $self->use_some_devperls; } ) 0 0 0
68 0 ▶ /^ all $/x && case { $self->use_all_devperls };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
/^ all $/x and &case(sub { $self->use_all_devperls; } ) 0 0 0
69 0 panic "unknown devperl argument: $_";
70 }
71 }
72  
73 0 ▶sub use_no_devperls { &ENTER_TRACE;
Subroutine use_no_devperls: not called CC=1 SCAR=6.9
Pod documented
74 0 my $self = &myself;
75 0 bad_args(@_ > 0);
76 0 $self->forgotten_devperls(DEVPERL_NONE);
77 }
78  
79 14 ▶sub use_some_devperls { &ENTER_TRACE;
Subroutine use_some_devperls: called CC=1 SCAR=0.0
Pod documented
80 14 my $self = &myself;
81 14 bad_args(@_ > 0);
82 14 $self->forgotten_devperls(DEVPERL_SOME);
83 }
84  
85 0 ▶sub use_all_devperls { &ENTER_TRACE;
Subroutine use_all_devperls: not called CC=1 SCAR=6.9
Pod documented
86 0 my $self = &myself;
87 0 bad_args(@_ > 0);
88 0 $self->forgotten_devperls(DEVPERL_ALL);
89 }
90  
91 44 ▶sub forgotten_devperls { &ENTER_TRACE_2;
Subroutine forgotten_devperls: called CC=2 SCAR=6.9
Pod documented
92 44 my $self = &myself;
93 44 bad_args(@_ > 1);
94 44 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 23 21 44
95 23 my($level) = @_;
96 23 good_args looks_like_number $level;
97 23 good_args $level >= DEVPERL__MIN;
98 23 good_args $level <= DEVPERL__MAX;
99 23 $$self{+WHICH_DEVPERLS} = $level;
100 }
101 44 return $$self{+WHICH_DEVPERLS};
102 }
103  
104 12 ▶sub some_devperl_dir { &ENTER_TRACE;
Subroutine some_devperl_dir: called CC=3 SCAR=11.2
Pod documented
105 12 my $self = &myself;
106 12 my($dir, @args) = @_;
107 12 ▶ my $forgotten = $self->forgotten_devperls || return;
Condition50%1/2
$self->forgotten_devperls || (return)
l!l
120
MC/DC0%0/1
$self->forgotten_devperls || (return)
$self->forgotten_devperls
Truth table50%1/2
A
A= $self->forgotten_devperls
Aresult
11
00
108 12 ▶ my $method = $forgotten == DEVPERL_SOME ? "forgotten" : "find";
Branch: 1 branch
BranchTrueFalseTotal
$forgotten == 1 ? : 12 0 12
109 12 $method .= "_devperl_" . $dir;
110 12 return $self->$method;
111 }
112  
113 4 ▶sub find_devperl_lib { &ENTER_TRACE_2;
Subroutine find_devperl_lib: called CC=1 SCAR=0.0
Pod documented
114 4 my $self = &myself;
115 4 return (); # because we by definition already have it
116 }
117  
118 4 ▶sub forgotten_devperl_lib { &ENTER_TRACE_3;
Subroutine forgotten_devperl_lib: called CC=1 SCAR=0.0
Pod documented
119 4 my $self = &myself;
120 4 return $self->find_devperl_lib;
121 }
122  
123 4 ▶sub find_devperl_bin { &ENTER_TRACE_2;
Subroutine find_devperl_bin: called CC=1 SCAR=0.0
Pod documented
124 4 my $self = &myself;
125 4 my @devperl_bins = uniq_files @Config{ <{site,vendor,install}bin> };
126 4 return @devperl_bins;
127 }
128  
129 4 ▶sub forgotten_devperl_bin { &ENTER_TRACE_3;
Subroutine forgotten_devperl_bin: called CC=1 SCAR=0.0
Pod documented
130 4 my $self = &myself;
131 4 my @bins = $self->find_devperl_bin;
132 4 firsts_not_in_second(@bins, @PATH);
133 }
134  
135 4 ▶sub find_devperl_man { &ENTER_TRACE_2;
Subroutine find_devperl_man: called CC=1 SCAR=0.0
Pod documented
136 4 my $self = &myself; ## NOT USED
137 4 uniq_files map {dirname} @Config{sysman => <{site,vendor,install}man{1,3}dir>};
138 }
139  
140 4 ▶sub forgotten_devperl_man { &ENTER_TRACE_3;
Subroutine forgotten_devperl_man: called CC=1 SCAR=0.0
Pod documented
141 4 my $self = &myself;
142 4 my @men = $self->find_devperl_man;
143 4 firsts_not_in_second(@men, @MANPATH);
144 }
145  
146 6 1;
147  
148 =encoding utf8
149  
150 =head1 NAME
151  
152 FindApp::Devperl - FIXME
153  
154 =head1 SYNOPSIS
155  
156 use FindApp::Devperl;
157  
158 =head1 DESCRIPTION
159  
160 =head2 Pluskey Attributes
161  
162 These are always private; use the methods insteads.
163  
164 =over
165  
166 =item WHICH_DEVPERLS
167  
168 =back
169  
170 =head2 Methods
171  
172 =over
173  
174 =item copy
175  
176 =item find_devperl_bin
177  
178 =item find_devperl_lib
179  
180 =item find_devperl_man
181  
182 =item findapp_root
183  
184 This is an override.
185  
186 =item findapp_root_from_path
187  
188 This is an override.
189  
190 =item forgotten_devperl_bin
191  
192 =item forgotten_devperl_lib
193  
194 =item forgotten_devperl_man
195  
196 =item forgotten_devperls
197  
198 =item init
199  
200 =item some_devperl_dir
201  
202 =item use_all_devperls
203  
204 =item use_my_devperl
205  
206 =item use_no_devperls
207  
208 =item use_some_devperls
209  
210 =back
211  
212 =head2 Exports
213  
214 =over
215  
216 =item FIXME
217  
218 =back
219  
220 =head1 EXAMPLES
221  
222 =head1 ENVIRONMENT
223  
224 =head1 SEE ALSO
225  
226 =over
227  
228 =item L<FindApp>
229  
230 =back
231  
232 =head1 CAVEATS AND PROVISOS
233  
234 =head1 BUGS AND LIMITATIONS
235  
236 =head1 HISTORY
237  
238 =head1 AUTHOR
239  
240 Tom Christiansen << <tchrist@perl.com> >>
241  
242 =head1 LICENCE AND COPYRIGHT
243  
244 Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>.
245 All Rights Reserved.
246  
247 This module is free software; you can redistribute it and/or
248 modify it under the same terms as Perl itself. See L<perlartistic>.
249  
250 =cut
251  
« blib/lib/FindApp/Utils/Package/Object.pm ↑ Summary lib/FindApp/Object/Behavior.pm »