| 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::BaseName::MatchRegexp::File; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 9 | our $VERSION = '1.001003'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # ABSTRACT: Match if any children have basename's that match a regexp and are files | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 9 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 9 | ▶ | use Role::Tiny qw( with ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 9 | with 'Path::IsDev::Role::Matcher::Child::BaseName::MatchRegexp'; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 5 | ▶ | sub _this_child_isfile { | ||||||||||||||||||||||||||
|
Subroutine
_this_child_isfile: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 38 | 5 | my ( $self, $result_object, $child ) = @_; | |||||||||||||||||||||||||||
| 39 | 5 | my $ctx = { | |||||||||||||||||||||||||||
| 40 | 'child' => "$child", | ||||||||||||||||||||||||||||
| 41 | tests => [], | ||||||||||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||||||||||
| 43 | 5 | my $tests = $ctx->{tests}; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | ## no critic (ValuesAndExpressions::ProhibitFiletest_f) | ||||||||||||||||||||||||||||
| 46 | 5 | ▶ | if ( -f $child ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 3 | push @{$tests}, { 'child_isfile?' => 1 }; | |||||||||||||||||||||||||||
| 48 | 3 | $result_object->add_reason( $self, 1, "$child is a file", $ctx ); | |||||||||||||||||||||||||||
| 49 | 3 | return 1; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 2 | push @{$tests}, { 'child_isfile?' => 0 }; | |||||||||||||||||||||||||||
| 52 | 2 | $result_object->add_reason( $self, 0, "$child is not a file", $ctx ); | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 2 | return; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 9 | ▶ | sub child_basename_matchregexp_file { | ||||||||||||||||||||||||||
|
Subroutine
child_basename_matchregexp_file: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 71 | 9 | my ( $self, $result_object, $regexp ) = @_; | |||||||||||||||||||||||||||
| 72 | 9 | for my $child ( $result_object->path->children ) { | |||||||||||||||||||||||||||
| 73 | 24 | ▶ | return 1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->_this_child_matchregexp($result_object, $child, $regexp) and $self->_this_child_isfile($result_object, $child)
MC/DC100%2/2
$self->_this_child_matchregexp($result_object, $child, $regexp) and $self->_this_child_isfile($result_object, $child)
$self->_this_child_matchregexp($result_object, $child, $regexp)
$self->_this_child_isfile($result_object, $child)
Truth table100%3/3
A and B
A= $self->_this_child_matchregexp($result_object, $child, $regexp)B= $self->_this_child_isfile($result_object, $child)
| |||||||||||||||||||||||||||||
| 74 | if $self->_this_child_matchregexp( $result_object, $child, $regexp ) | ||||||||||||||||||||||||||||
| 75 | and $self->_this_child_isfile( $result_object, $child ); | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | 6 | return; | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 9 | 1; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | __END__ | ||||||||||||||||||||||||||||