lib/XT/Files/Plugin/Dirs.pm

filter: Statementstmt 100% 38 / 38 Branchbran 87.5% 7 / 8 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 98.3% 60 / 61 CC 9 SCAR 18.8
CC
9
Cov
98%
run
9.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« blib/lib/XT/Files/Plugin.pm ↑ Summary lib/XT/Files.pm »
1 package XT::Files::Plugin::Dirs;
2  
3 6 ▶use 5.006;
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  
7 6 our $VERSION = '0.001';
8  
9 6 ▶use parent 'XT::Files::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub run {
12 8 ▶ my ( $self, $args ) = @_;
Subroutine run: called CC=9 SCAR=22.0
Pod documented
13  
14 8 my @dirs;
15  
16 ARG:
17 8 for my $arg ( @{$args} ) {
18 19 my ( $key, $value ) = @{$arg};
19  
20 19 ▶ if ( ( $key eq 'bin' ) || ( $key eq 'module' ) || ( $key eq 'test' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "bin" or $key eq "module" or $key eq "test") 8 1 9
Condition100%6/6
$key eq "bin" or $key eq "module" or $key eq "test"
l!l&&r!l&&!r
1621
$key eq "bin" or $key eq "module"
l!l&&r!l&&!r
1063
MC/DC100%3/3
$key eq "bin" or $key eq "module" or $key eq "test"
$key eq "bin" $key eq "module" $key eq "test"
Truth table100%4/4
A or B or C
A= $key eq "bin"B= $key eq "module"C= $key eq "test"
ABCresult
1XX1
01X1
0011
0000
21 18 push @dirs, $arg;
22 18 next ARG;
23 }
24  
25 1 $self->log_fatal("Invalid configuration option '$key = $value' for plugin 'Dirs'");
26 }
27  
28 7 my $xtf = $self->xtf;
29  
30 # We sort the dirs because e.g. bin/lib must be scanned before bin
31 # because bin_dir() would add every file found.
32 #
33 # By reverse sorting we guarantee that we always scan the most
34 # significant directory first.
35 DIR:
36 7 for my $dir ( reverse sort { $a->[1] cmp $b->[1] } @dirs ) {
37 18 my ( $type, $name ) = @{$dir};
38  
39 18 ▶ if ( $type eq 'bin' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "bin") 10 8 18
40 10 $xtf->bin_dir($name);
41 10 next DIR;
42 }
43  
44 8 ▶ if ( $type eq 'module' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "module") 6 2 8
45 6 $xtf->module_dir($name);
46 6 next DIR;
47 }
48  
49 2 ▶ if ( $type eq 'test' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "test") 2 0 2
50 2 $xtf->test_dir($name);
51 2 next DIR;
52 }
53 }
54  
55 7 return;
56 }
57  
58 6 1;
59  
60 __END__
« blib/lib/XT/Files/Plugin.pm ↑ Summary lib/XT/Files.pm »