| 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
Condition100%6/6
$key eq "bin" or $key eq "module" or $key eq "test"
$key eq "bin" or $key eq "module"
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"
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 10 | $xtf->bin_dir($name); | |||||||||||||||||||||||||||||||||||||||||
| 41 | 10 | next DIR; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 8 | ▶ | if ( $type eq 'module' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 6 | $xtf->module_dir($name); | |||||||||||||||||||||||||||||||||||||||||
| 46 | 6 | next DIR; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 2 | ▶ | if ( $type eq 'test' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | $xtf->test_dir($name); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 2 | next DIR; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | __END__ | ||||||||||||||||||||||||||||||||||||||||||