| 1 | 10 | ▶ | use 5.008; # utf8 | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 10 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | package Path::IsDev::Role::Matcher::Child::BaseName::MatchRegexp; | ||||||||||
| 7 | |||||||||||
| 8 | 10 | our $VERSION = '1.001003'; | |||||||||
| 9 | |||||||||||
| 10 | # ABSTRACT: Match when a path has a child file matching an expression | ||||||||||
| 11 | |||||||||||
| 12 | 10 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||
| 13 | |||||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | 10 | ▶ | use Role::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 24 | ▶ | sub _this_child_matchregexp { | ||||||||
|
Subroutine
_this_child_matchregexp: called CC=2 SCAR=6.9
| |||||||||||
| 36 | 24 | my ( $self, $result_object, $child, $regexp ) = @_; | |||||||||
| 37 | 24 | my $ctx = { | |||||||||
| 38 | 'child' => "$child", | ||||||||||
| 39 | 'child_basename' => $child->basename, | ||||||||||
| 40 | expression => $regexp, | ||||||||||
| 41 | tests => [], | ||||||||||
| 42 | }; | ||||||||||
| 43 | 24 | my $tests = $ctx->{tests}; | |||||||||
| 44 | |||||||||||
| 45 | 24 | ▶ | if ( $child->basename =~ $regexp ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 5 | push @{$tests}, { 'child_basename_matches_expression?' => 1 }; | |||||||||
| 47 | 5 | $result_object->add_reason( $self, 1, $child->basename . " matches $regexp", $ctx ); | |||||||||
| 48 | 5 | return 1; | |||||||||
| 49 | } | ||||||||||
| 50 | 19 | push @{$tests}, { 'child_basename_matches_expression?' => 0 }; | |||||||||
| 51 | 19 | $result_object->add_reason( $self, 0, $child->basename . " does not match $regexp", $ctx ); | |||||||||
| 52 | 19 | return; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | |||||||||||
| 57 | |||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | |||||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | sub child_basename_matchregexp { | ||||||||
|
Subroutine
child_basename_matchregexp: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 68 | 0 | my ( $self, $result_object, $regexp ) = @_; | |||||||||
| 69 | 0 | for my $child ( $result_object->path->children ) { | |||||||||
| 70 | 0 | ▶ | return 1 if $self->_this_child_matchregexp( $result_object, $child, $regexp ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | } | ||||||||||
| 72 | 0 | return; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 10 | 1; | |||||||||
| 76 | |||||||||||
| 77 | __END__ | ||||||||||