| 1 | 9 | ▶ | use 5.008; # utf8 | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package Path::IsDev::Role::Matcher::Child::Exists::Any::Dir; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 9 | our $VERSION = '1.001003'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # ABSTRACT: Match if a path contains one of any of a list of directories | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 9 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 9 | ▶ | use Role::Tiny qw( with ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 9 | with 'Path::IsDev::Role::Matcher::Child::Exists::Any'; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | sub child_exists_dir { | ||||||||||||||||||||||||||
|
Subroutine
child_exists_dir: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 1 | my ( $self, $result_object, $child ) = @_; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 1 | my $child_path = $result_object->path->child($child); | |||||||||||||||||||||||||||
| 41 | 1 | my $ctx = { 'child_name' => $child, child_path => "$child_path", tests => [] }; | |||||||||||||||||||||||||||
| 42 | 1 | my $tests = $ctx->{tests}; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | ▶ | if ( -d $child_path ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 1 | push @{$tests}, { 'child_path_isdir?' => 1 }; | |||||||||||||||||||||||||||
| 46 | 1 | $result_object->add_reason( $self, 1, "$child_path is a dir", $ctx ); | |||||||||||||||||||||||||||
| 47 | 1 | return 1; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 0 | push @{$tests}, { 'child_path_isdir?' => 0 }; | |||||||||||||||||||||||||||
| 50 | 0 | $result_object->add_reason( $self, 0, "$child_path is not a dir", $ctx ); | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | return; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 9 | ▶ | sub child_exists_any_dir { | ||||||||||||||||||||||||||
|
Subroutine
child_exists_any_dir: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | 9 | my ( $self, $result_object, @children ) = @_; | |||||||||||||||||||||||||||
| 65 | 9 | for my $child (@children) { | |||||||||||||||||||||||||||
| 66 | 15 | ▶ | return 1 if $self->child_exists( $result_object, $child ) and $self->child_exists_dir( $result_object, $child ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->child_exists($result_object, $child) and $self->child_exists_dir($result_object, $child)
MC/DC50%1/2
$self->child_exists($result_object, $child) and $self->child_exists_dir($result_object, $child)
$self->child_exists($result_object, $child)
$self->child_exists_dir($result_object, $child)
Truth table66%2/3
A and B
A= $self->child_exists($result_object, $child)B= $self->child_exists_dir($result_object, $child)
| |||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 8 | return; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 9 | 1; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||