FindApp/Object/Behavior/Devperl.pm

filter: Statementstmt 83.3% 95 / 114 Branchbran 37.5% 6 / 16 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 79.3% 23 / 29 Podpod 100% 15 / 15 totaltotal 77.6% 142 / 183 CC 14 SCAR 20.2
CC
14
Cov
76%
use_my_devperl
42.0
findapp_root_from_path
4.0
some_devperl_dir
3.1
CRAP 7.6
« FindApp/Utils/Package.pm ↑ Summary FindApp/Utils/Objects.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
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 };
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(
Subroutine BEGIN: called CC=1 SCAR=0.0
29 WHICH_DEVPERLS
30 6 );
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=2 SCAR=7.0
Pod documented
141 4 my $self = &myself;
142 4 my @men = $self->find_devperl_man;
143 4 ▶ my @manpath = split /:/, $MANPATH || "", -1;
Condition50%1/2
$FindApp::Object::Behavior::Devperl::MANPATH || ''
l!l
04
MC/DC0%0/1
$FindApp::Object::Behavior::Devperl::MANPATH || ''
$FindApp::Object::Behavior::Devperl::MANPATH
Truth table50%1/2
A
A= $FindApp::Object::Behavior::Devperl::MANPATH
Aresult
11
00
144 4 firsts_not_in_second(@men, @manpath);
145 }
146  
147 6 1;
148  
149 =encoding utf8
150  
151 =head1 NAME
152  
153 FindApp::Devperl - FIXME
154  
155 =head1 SYNOPSIS
156  
157 use FindApp::Devperl;
158  
159 =head1 DESCRIPTION
160  
161 =head2 Pluskey Attributes
162  
163 These are always private; use the methods insteads.
164  
165 =over
166  
167 =item WHICH_DEVPERLS
168  
169 =back
170  
171 =head2 Methods
172  
173 =over
174  
175 =item copy
176  
177 =item find_devperl_bin
178  
179 =item find_devperl_lib
180  
181 =item find_devperl_man
182  
183 =item findapp_root
184  
185 This is an override.
186  
187 =item findapp_root_from_path
188  
189 This is an override.
190  
191 =item forgotten_devperl_bin
192  
193 =item forgotten_devperl_lib
194  
195 =item forgotten_devperl_man
196  
197 =item forgotten_devperls
198  
199 =item init
200  
201 =item some_devperl_dir
202  
203 =item use_all_devperls
204  
205 =item use_my_devperl
206  
207 =item use_no_devperls
208  
209 =item use_some_devperls
210  
211 =back
212  
213 =head2 Exports
214  
215 =over
216  
217 =item FIXME
218  
219 =back
220  
221 =head1 EXAMPLES
222  
223 =head1 ENVIRONMENT
224  
225 =head1 SEE ALSO
226  
227 =over
228  
229 =item L<FindApp>
230  
231 =back
232  
233 =head1 CAVEATS AND PROVISOS
234  
235 =head1 BUGS AND LIMITATIONS
236  
237 =head1 HISTORY
238  
239 =head1 AUTHOR
240  
241 Tom Christiansen << <tchrist@perl.com> >>
242  
243 =head1 LICENCE AND COPYRIGHT
244  
245 Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>.
246 All Rights Reserved.
247  
248 This module is free software; you can redistribute it and/or
249 modify it under the same terms as Perl itself. See L<perlartistic>.
250  
251 =cut
252  
« FindApp/Utils/Package.pm ↑ Summary FindApp/Utils/Objects.pm »