Midgen/Role/UseModule.pm

filter: Statementstmt 16.8% 25 / 148 Branchbran 0.0% 0 / 110 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 25.0% 7 / 28 Podpod 100% 1 / 1 totaltotal 10.7% 33 / 308 CC 73 SCAR 44.8
CC
73
Cov
9%
_module_names_ppi_sl
272.0
__ANON__
110.0
xtests_use_module
90.0
CRAP 87.8
« Midgen/Role/Eval.pm ↑ Summary Midgen/Role/Output/MI.pm »
1 package App::Midgen::Role::UseModule;
2  
3 2 ▶use constant {BLANK => q{ }, TRUE => 1, FALSE => 0, NONE => q{}, TWO => 2,
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 THREE => 3,};
5  
6 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 requires
8 qw( ppi_document debug verbose format xtest _process_found_modules develop meta2 );
9  
10 2 our $VERSION = '0.34';
11 2 $VERSION = eval $VERSION; ## no critic
12  
13 2 ▶use PPI;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Data::Printer {caller_info => 1,};
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use Tie::Static qw(static);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18  
19 #######
20 # composed method - _xtests_in_single_quote
21 #######
22 0 ▶sub xtests_use_module {
Subroutine xtests_use_module: not called CC=9 SCAR=45.0
Pod documented
23 0 my $self = shift;
24 0 ▶ my $phase_relationship = shift || NONE;
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
25  
26 0 my @modules;
27 my @version_strings;
28  
29 # bug out if there is no Include for Module::Runtime found
30 0 ▶ return if $self->_is_module_runtime() eq FALSE;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_module_runtime eq 0 0 0 0
31  
32 ## say 'Option 1: use_module( M::N )...';
33  
34 #
35 # use_module("Math::BigInt", 1.31)->new("1_234");
36 #
37 #PPI::Document
38 # PPI::Statement
39 # PPI::Token::Whitespace ' '
40 # PPI::Token::Word 'use_module'
41 # PPI::Structure::List ( ... )
42 # PPI::Statement::Expression
43 # PPI::Token::Quote::Double '"Math::BigInt"'
44 # PPI::Token::Operator ','
45 # PPI::Token::Whitespace ' '
46 # PPI::Token::Number::Float '1.31'
47 # PPI::Token::Operator '->'
48 # PPI::Token::Word 'new'
49 # PPI::Structure::List ( ... )
50 # PPI::Statement::Expression
51 # PPI::Token::Quote::Double '"1_234"'
52 # PPI::Token::Structure ';'
53 # PPI::Token::Whitespace '\n'
54  
55 0 ▶ try {
Subroutine __ANON__: not called CC=9 SCAR=45.0
56 0 my @chunks1 = @{$self->ppi_document->find('PPI::Statement')};
57  
58 0 foreach my $chunk (@chunks1) {
59  
60 0 ▶ if (not $chunk->find(sub { $_[1]->isa('PPI::Token::Symbol') })) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless ($chunk->find(sub { $_[1]->isa("PPI::Token::Symbol"); } )) 0 0 0
61  
62 # test for module-runtime key-words
63 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically|require_module)\z/; } )) 0 0 0
64 $chunk->find(
65 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
66 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically|require_module)\z/ 0 0 0
67 and $_[1]->content
68 =~ m{\A[Module::Runtime::]*(?:use_module|use_package_optimistically|require_module)\z};
69 }
70 )
71 )
72 {
73 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
unless ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:return)\z/; } )) 0 0 0
74 not $chunk->find(
75 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
76 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:return)\z/ 0 0 0
77 and $_[1]->content =~ m{\A(?:return)\z};
78 }
79 )
80 )
81 {
82  
83 0 for (0 .. $#{$chunk->{children}}) {
84  
85 # find all ppi_sl
86 0 ▶ if ($chunk->{children}[$_]->isa('PPI::Structure::List')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->{"children"}[$_]->isa("PPI::Structure::List")) 0 0 0
87  
88 my $ppi_sl = $chunk->{children}[$_]
89 0 ▶ if $chunk->{children}[$_]->isa('PPI::Structure::List');
Branch: 1 branch
BranchTrueFalseTotal
if $chunk->{"children"}[$_]->isa("PPI::Structure::List") 0 0 0
90  
91 0 ▶ print "Option 1: use_module( M::N )...\n" if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
92 0 $self->_module_names_ppi_sl($ppi_sl, \@modules,
93 \@version_strings);
94 }
95 }
96 }
97 }
98 }
99 }
100 0 };
101  
102  
103 ## say 'Option 2: my $q = use_module( M::N )...';
104  
105  
106 #
107 # my $bi = use_module("Math::BigInt", 1.31)->new("1_234");
108 #
109 #PPI::Document
110 # PPI::Statement::Variable
111 # PPI::Token::Word 'my'
112 # PPI::Token::Whitespace ' '
113 # PPI::Token::Symbol '$bi'
114 # PPI::Token::Whitespace ' '
115 # PPI::Token::Operator '='
116 # PPI::Token::Whitespace ' '
117 # PPI::Token::Word 'use_module'
118 # PPI::Structure::List ( ... )
119 # PPI::Statement::Expression
120 # PPI::Token::Quote::Double '"Math::BigInt"'
121 # PPI::Token::Operator ','
122 # PPI::Token::Whitespace ' '
123 # PPI::Token::Number::Float '1.31'
124 # PPI::Token::Operator '->'
125 # PPI::Token::Word 'new'
126 # PPI::Structure::List ( ... )
127 # PPI::Statement::Expression
128 # PPI::Token::Quote::Double '"1_234"'
129 # PPI::Token::Structure ';'
130 # PPI::Token::Whitespace '\n'
131  
132  
133 0 ▶ try {
Subroutine __ANON__: not called CC=8 SCAR=42.8
134 # let's extract all ppi_sv
135 0 my @chunks2 = @{$self->ppi_document->find('PPI::Statement::Variable')};
136 0 foreach my $chunk (@chunks2) {
137  
138 # test for my
139 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:my)\z/; } )) 0 0 0
140 $chunk->find(
141 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
142 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:my)\z/ 0 0 0
143 and $_[1]->content =~ m{\A(?:my)\z};
144 }
145 )
146 )
147 {
148 # test for module-runtime key-words
149 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z/; } )) 0 0 0
150 $chunk->find(
151 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
152 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z/ 0 0 0
153 and $_[1]->content
154 =~ m{\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z};
155 }
156 )
157 )
158 {
159 0 for (0 .. $#{$chunk->{children}}) {
160  
161 # find all ppi_sl
162 0 ▶ if ($chunk->{children}[$_]->isa('PPI::Structure::List')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->{"children"}[$_]->isa("PPI::Structure::List")) 0 0 0
163  
164 my $ppi_sl = $chunk->{children}[$_]
165 0 ▶ if $chunk->{children}[$_]->isa('PPI::Structure::List');
Branch: 1 branch
BranchTrueFalseTotal
if $chunk->{"children"}[$_]->isa("PPI::Structure::List") 0 0 0
166  
167 0 ▶ print "Option 2: my \$q = use_module( M::N )...\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
168 if $self->debug;
169 0 $self->_module_names_ppi_sl($ppi_sl, \@modules,
170 \@version_strings);
171  
172  
173 }
174 }
175 }
176 }
177 }
178 0 };
179  
180  
181 ## say 'Option 3: $q = use_module( M::N )...';
182  
183 #
184 # $bi = use_module("Math::BigInt", 1.31)->new("1_234");
185 #
186 #PPI::Document
187 # PPI::Statement
188 # PPI::Token::Symbol '$bi'
189 # PPI::Token::Whitespace ' '
190 # PPI::Token::Operator '='
191 # PPI::Token::Whitespace ' '
192 # PPI::Token::Word 'use_module'
193 # PPI::Structure::List ( ... )
194 # PPI::Statement::Expression
195 # PPI::Token::Quote::Double '"Math::BigInt"'
196 # PPI::Token::Operator ','
197 # PPI::Token::Whitespace ' '
198 # PPI::Token::Number::Float '1.31'
199 # PPI::Token::Operator '->'
200 # PPI::Token::Word 'new'
201 # PPI::Structure::List ( ... )
202 # PPI::Statement::Expression
203 # PPI::Token::Quote::Double '"1_234"'
204 # PPI::Token::Structure ';'
205 # PPI::Token::Whitespace '\n'
206  
207 0 ▶ try {
Subroutine __ANON__: not called CC=10 SCAR=47.0
208 0 my @chunks1 = @{$self->ppi_document->find('PPI::Statement')};
209  
210 0 foreach my $chunk (@chunks1) {
211  
212 # test for not my
213 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
unless ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:my)\z/; } )) 0 0 0
214 not $chunk->find(
215 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
216 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:my)\z/ 0 0 0
217 and $_[1]->content =~ m{\A(?:my)\z};
218 }
219 )
220 )
221 {
222  
223 0 ▶ if ($chunk->find(sub { $_[1]->isa('PPI::Token::Symbol') })) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Symbol"); } )) 0 0 0
224  
225 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Operator") and $_[1]->content eq "="; } )) 0 0 0
226 $chunk->find(
227 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
228 0 ▶ $_[1]->isa('PPI::Token::Operator') and $_[1]->content eq '=';
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Operator") and $_[1]->content eq "=" 0 0 0
229 }
230 )
231 )
232 {
233  
234 # test for module-runtime key-words
235 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z/; } )) 0 0 0
236 $chunk->find(
237 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
238 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z/ 0 0 0
239 and $_[1]->content
240 =~ m{\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z};
241 }
242 )
243 )
244 {
245 0 for (0 .. $#{$chunk->{children}}) {
246  
247 # find all ppi_sl
248 0 ▶ if ($chunk->{children}[$_]->isa('PPI::Structure::List')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->{"children"}[$_]->isa("PPI::Structure::List")) 0 0 0
249  
250 my $ppi_sl = $chunk->{children}[$_]
251 0 ▶ if $chunk->{children}[$_]->isa('PPI::Structure::List');
Branch: 1 branch
BranchTrueFalseTotal
if $chunk->{"children"}[$_]->isa("PPI::Structure::List") 0 0 0
252  
253 0 ▶ print "Option 3: \$q = use_module( M::N )...\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
254 if $self->debug;
255 0 $self->_module_names_ppi_sl($ppi_sl, \@modules,
256 \@version_strings);
257  
258 }
259 }
260 }
261 }
262 }
263 }
264 }
265 0 };
266  
267  
268 ## say 'Option 4: return use_module( M::N )...';
269  
270 #
271 # return use_module(\'App::SCS::PageSet\')->new(
272 # base_dir => $self->share_dir->catdir(\'pages\'),
273 # plugin_config => $self->page_plugin_config,
274 # );
275 #
276 #PPI::Document
277 # PPI::Statement::Break
278 # PPI::Token::Word 'return'
279 # PPI::Token::Whitespace ' '
280 # PPI::Token::Word 'use_module'
281 # PPI::Structure::List ( ... )
282 # PPI::Statement::Expression
283 # PPI::Token::Quote::Single ''App::SCS::PageSet''
284 # PPI::Token::Operator '->'
285 # PPI::Token::Word 'new'
286 # PPI::Structure::List ( ... )
287 # PPI::Token::Whitespace '\n'
288 # PPI::Token::Whitespace ' '
289 # PPI::Statement::Expression
290 # PPI::Token::Word 'base_dir'
291 # PPI::Token::Whitespace ' '
292 # PPI::Token::Operator '=>'
293 # PPI::Token::Whitespace ' '
294 # PPI::Token::Symbol '$self'
295 # PPI::Token::Operator '->'
296 # PPI::Token::Word 'share_dir'
297 # PPI::Token::Operator '->'
298 # PPI::Token::Word 'catdir'
299 # PPI::Structure::List ( ... )
300 # PPI::Statement::Expression
301 # PPI::Token::Quote::Single ''pages''
302 # PPI::Token::Operator ','
303 # PPI::Token::Whitespace '\n'
304 # PPI::Token::Whitespace ' '
305 # PPI::Token::Word 'plugin_config'
306 # PPI::Token::Whitespace ' '
307 # PPI::Token::Operator '=>'
308 # PPI::Token::Whitespace ' '
309 # PPI::Token::Symbol '$self'
310 # PPI::Token::Operator '->'
311 # PPI::Token::Word 'page_plugin_config'
312 # PPI::Token::Operator ','
313 # PPI::Token::Whitespace '\n'
314 # PPI::Token::Whitespace ' '
315 # PPI::Token::Structure ';'
316  
317 0 ▶ try {
Subroutine __ANON__: not called CC=8 SCAR=42.8
318 0 my @chunks4 = @{$self->ppi_document->find('PPI::Statement::Break')};
319  
320 0 for my $chunk (@chunks4) {
321  
322 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:return)\z/; } )) 0 0 0
323 $chunk->find(
324 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
325 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A(?:return)\z/ 0 0 0
326 and $_[1]->content =~ m{\A(?:return)\z};
327 }
328 )
329 )
330 {
331  
332 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->find(sub { $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z/; } )) 0 0 0
333 $chunk->find(
334 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
335 0 ▶ $_[1]->isa('PPI::Token::Word')
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z/ 0 0 0
336 and $_[1]->content
337 =~ m{\A[Module::Runtime::]*(?:use_module|use_package_optimistically)\z};
338 }
339 )
340 )
341 {
342 0 for (0 .. $#{$chunk->{children}}) {
343  
344 # find all ppi_sl
345 0 ▶ if ($chunk->{children}[$_]->isa('PPI::Structure::List')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($chunk->{"children"}[$_]->isa("PPI::Structure::List")) 0 0 0
346 my $ppi_sl = $chunk->{children}[$_]
347 0 ▶ if $chunk->{children}[$_]->isa('PPI::Structure::List');
Branch: 1 branch
BranchTrueFalseTotal
if $chunk->{"children"}[$_]->isa("PPI::Structure::List") 0 0 0
348 0 ▶ print "Option 4: return use_module( M::N )...\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
349 if $self->debug;
350 0 $self->_module_names_ppi_sl($ppi_sl, \@modules,
351 \@version_strings,);
352  
353  
354 }
355 }
356 }
357 }
358 }
359 0 };
360  
361 # p @version_strings;
362 0 ▶ @version_strings = map { defined $_ ? $_ : 0 } @version_strings;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
363 0 ▶ p @modules if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
364 0 ▶ p @version_strings if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
365 0 ▶ if (scalar @modules > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @modules > 0) 0 0 0
366  
367 0 for (0 .. $#modules) {
368 0 ▶ print "Info: UseModule -> Sending $modules[$_] - $version_strings[$_]\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose == 2 0 0 0
369 if ($self->verbose == TWO);
370 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
371 0 $self->_process_found_modules(
372 $phase_relationship, $modules[$_], $version_strings[$_],
373 __PACKAGE__, $phase_relationship,
374 );
375 0 };
376 }
377 }
378  
379 0 return;
380 }
381  
382  
383 #######
384 # composed method test for include Module::Runtime
385 #######
386 0 ▶sub _is_module_runtime {
Subroutine _is_module_runtime: not called CC=2 SCAR=17.9
387 0 my $self = shift;
388 0 my $module_runtime_include_found = FALSE;
389  
390 #PPI::Document
391 # PPI::Statement::Include
392 # PPI::Token::Word 'use'
393 # PPI::Token::Whitespace ' '
394 # PPI::Token::Word 'Module::Runtime'
395  
396 0 ▶ try {
Subroutine __ANON__: not called CC=7 SCAR=40.3
397 0 my $includes = $self->ppi_document->find('PPI::Statement::Include');
398 0 ▶ if ($includes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($includes) 0 0 0
399 0 foreach my $include (@{$includes}) {
400 0 ▶ next if $include->type eq 'no';
Branch: 1 branch
BranchTrueFalseTotal
if $include->type eq "no" 0 0 0
401 0 ▶ if (not $include->pragma) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($include->pragma) 0 0 0
402 0 my $module = $include->module;
403  
404 0 ▶ if ($module eq 'Module::Runtime') {
Branch: 1 branch
BranchTrueFalseTotal
if ($module eq "Module::Runtime") 0 0 0
405 0 $module_runtime_include_found = TRUE;
406 0 ▶ p $module if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
407 }
408 }
409 }
410 }
411 0 };
412 0 ▶ p $module_runtime_include_found if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
413 0 return $module_runtime_include_found;
414  
415 }
416  
417  
418 #######
419 # composed method extract module name from PPI::Structure::List
420 #######
421 0 ▶sub _module_names_ppi_sl {
Subroutine _module_names_ppi_sl: not called CC=16 SCAR=56.1
422 0 my ($self, $ppi_sl, $mn_ref, $mv_ref) = @_;
423  
424  
425 0 ▶ if ($ppi_sl->isa('PPI::Structure::List')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ppi_sl->isa("PPI::Structure::List")) 0 0 0
426  
427 0 static \my $previous_module;
428 0 foreach my $ppi_se (@{$ppi_sl->{children}}) {
429 0 for (0 .. $#{$ppi_se->{children}}) {
430  
431 0 ▶ if ( $ppi_se->{children}[$_]->isa('PPI::Token::Quote::Single')
Branch: 1 branch
BranchTrueFalseTotal
if ($ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")) 0 0 0
Condition0%0/3
$ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
l!l&&r!l&&!r
000
MC/DC0%0/2
$ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
$ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
Truth table0%0/3
A or B
A= $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single")B= $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
ABresult
1X1
011
000
432 || $ppi_se->{children}[$_]->isa('PPI::Token::Quote::Double'))
433 {
434 0 my $module = $ppi_se->{children}[$_]->content;
435 0 $module =~ s/(?:['|"])//g;
436 0 ▶ if ($module =~ m{\A(?:[a-zA-Z])}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($module =~ /\A(?:[a-zA-Z])/) 0 0 0
437 0 ▶ print "found module - $module\n" if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
438 0 push @{$mn_ref}, $module;
439 0 $mv_ref->[$#{$mn_ref}] = undef;
440 0 ▶ p @{$mn_ref} if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
441 0 $previous_module = $module;
442 }
443 }
444 0 ▶ if ( $ppi_se->{children}[$_]->isa('PPI::Token::Number::Float')
Branch: 1 branch
BranchTrueFalseTotal
if ($ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")) 0 0 0
Condition0%0/9
$ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
l!l&&r!l&&!r
000
$ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single")
l!l&&r!l&&!r
000
$ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version")
l!l&&r!l&&!r
000
MC/DC0%0/4
$ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") or $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
$ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float") $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version") $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single") $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
Truth table0%0/5
A or B or C or D
A= $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Float")B= $ppi_se->{"children"}[$_]->isa("PPI::Token::Number::Version")C= $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Single")D= $ppi_se->{"children"}[$_]->isa("PPI::Token::Quote::Double")
ABCDresult
1XXX1
01XX1
001X1
00011
00000
445 || $ppi_se->{children}[$_]->isa('PPI::Token::Number::Version')
446 || $ppi_se->{children}[$_]->isa('PPI::Token::Quote::Single')
447 || $ppi_se->{children}[$_]->isa('PPI::Token::Quote::Double'))
448 {
449 0 my $version_string = $ppi_se->{children}[$_]->content;
450 0 $version_string =~ s/(?:['|"])//g;
451 0 ▶ next if $version_string !~ m{\A[\d|v]};
Branch: 1 branch
BranchTrueFalseTotal
unless $version_string =~ /\A[\d|v]/ 0 0 0
452  
453 0 ▶ $version_string
Branch: 1 branch
BranchTrueFalseTotal
version::is_lax($version_string) ? : 0 0 0
454 = version::is_lax($version_string) ? $version_string : 0;
455  
456 0 ▶ print "Info: UseModule found version_string - $version_string\n"
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
457 if $self->debug;
458  
459 0 ▶ try {
Subroutine __ANON__: not called CC=3 SCAR=24.8
460 0 ▶ if ($previous_module) {
Branch: 1 branch
BranchTrueFalseTotal
if ($previous_module) 0 0 0
461 0 $self->{found_version}{$previous_module} = $version_string;
462 0 $mv_ref->[$#{$mn_ref}] = $version_string;
463 }
464 0 ▶ p $version_string if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
465 0 $previous_module = undef;
466 0 };
467 }
468 }
469 }
470 }
471 }
472  
473  
474 2 ▶no Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
475  
476 2 1;
477  
478 __END__
« Midgen/Role/Eval.pm ↑ Summary Midgen/Role/Output/MI.pm »