line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
57062
|
use 5.008; # utf8 |
|
9
|
|
|
|
|
36
|
|
|
9
|
|
|
|
|
456
|
|
2
|
9
|
|
|
9
|
|
57
|
use strict; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
322
|
|
3
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
294
|
|
4
|
9
|
|
|
9
|
|
1108
|
use utf8; |
|
9
|
|
|
|
|
32
|
|
|
9
|
|
|
|
|
65
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Path::IsDev::Role::Matcher::Child::BaseName::MatchRegexp::File; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.001002'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Match if any children have basename's that match a regexp and are files |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
13
|
|
|
|
|
|
|
|
14
|
9
|
|
|
9
|
|
13353
|
use Role::Tiny qw( with ); |
|
9
|
|
|
|
|
4565
|
|
|
9
|
|
|
|
|
74
|
|
15
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub _this_child_isfile { |
38
|
5
|
|
|
5
|
|
14
|
my ( $self, $result_object, $child ) = @_; |
39
|
5
|
|
|
|
|
18
|
my $ctx = { |
40
|
|
|
|
|
|
|
'child' => "$child", |
41
|
|
|
|
|
|
|
tests => [], |
42
|
|
|
|
|
|
|
}; |
43
|
5
|
|
|
|
|
38
|
my $tests = $ctx->{tests}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
## no critic (ValuesAndExpressions::ProhibitFiletest_f) |
46
|
5
|
100
|
|
|
|
18
|
if ( -f $child ) { |
47
|
3
|
|
|
|
|
136
|
push @{$tests}, { 'child_isfile?' => 1 }; |
|
3
|
|
|
|
|
10
|
|
48
|
3
|
|
|
|
|
15
|
$result_object->add_reason( $self, 1, "$child is a file", $ctx ); |
49
|
3
|
|
|
|
|
33
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
2
|
|
|
|
|
80
|
push @{$tests}, { 'child_isfile?' => 0 }; |
|
2
|
|
|
|
|
25
|
|
52
|
2
|
|
|
|
|
9
|
$result_object->add_reason( $self, 0, "$child is not a file", $ctx ); |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
17
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub child_basename_matchregexp_file { |
71
|
9
|
|
|
9
|
1
|
23
|
my ( $self, $result_object, $regexp ) = @_; |
72
|
9
|
|
|
|
|
322
|
for my $child ( $result_object->path->children ) { |
73
|
24
|
100
|
100
|
|
|
2180
|
return 1 |
74
|
|
|
|
|
|
|
if $self->_this_child_matchregexp( $result_object, $child, $regexp ) |
75
|
|
|
|
|
|
|
and $self->_this_child_isfile( $result_object, $child ); |
76
|
|
|
|
|
|
|
} |
77
|
6
|
|
|
|
|
244
|
return; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=encoding UTF-8 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Path::IsDev::Role::Matcher::Child::BaseName::MatchRegexp::File - Match if any children have basename's that match a regexp and are files |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 VERSION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
version 1.001002 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 C<child_basename_matchregexp_file> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$class->child_basename_matchregexp_file( $result_object, $regexp ); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Given a regexp C<$regexp>, match if any of C<< $result_object->path->children >> match the given regexp, |
104
|
|
|
|
|
|
|
on the condition that those that match are also files. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
if ( $self->child_basename_matchregexp_file( $result_object, qr/^Change(.*)$/i ) ) { |
107
|
|
|
|
|
|
|
# result_object->path() contains at least one child that is a file and matches the regexp |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 C<_this_child_isfile> |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
if ( $class->_this_child_isfile( $result_object, $child_path ) ) { |
115
|
|
|
|
|
|
|
... |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=begin MetaPOD::JSON v1.1.0 |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
{ |
121
|
|
|
|
|
|
|
"namespace":"Path::IsDev::Role::Matcher::Child::BaseName::MatchRegexp::File", |
122
|
|
|
|
|
|
|
"interface":"role", |
123
|
|
|
|
|
|
|
"does":"Path::IsDev::Role::Matcher::Child::BaseName::MatchRegexp" |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=end MetaPOD::JSON |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 AUTHOR |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Kent Fredric <kentfredric@gmail.com> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
138
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |