line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::Builder::Simple; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
9605
|
use Catmandu::Sane; |
|
18
|
|
|
|
|
51
|
|
|
18
|
|
|
|
|
117
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
18
|
|
|
18
|
|
11310
|
use List::MoreUtils qw(all_u any); |
|
18
|
|
|
|
|
176187
|
|
|
18
|
|
|
|
|
196
|
|
8
|
18
|
|
|
18
|
|
23207
|
use Catmandu::Util::Path qw(as_path); |
|
18
|
|
|
|
|
52
|
|
|
18
|
|
|
|
|
975
|
|
9
|
18
|
|
|
18
|
|
119
|
use Moo::Role; |
|
18
|
|
|
|
|
47
|
|
|
18
|
|
|
|
|
137
|
|
10
|
18
|
|
|
18
|
|
7447
|
use namespace::clean; |
|
18
|
|
|
|
|
54
|
|
|
18
|
|
|
|
|
148
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition::Builder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
requires 'path'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has mode => (is => 'lazy'); |
17
|
|
|
|
|
|
|
has value_tester => (is => 'lazy'); |
18
|
|
|
|
|
|
|
|
19
|
25
|
|
|
25
|
|
355
|
sub _build_mode {'all'} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _build_tester { |
22
|
30
|
|
|
30
|
|
455
|
my ($self) = @_; |
23
|
30
|
|
|
|
|
206
|
my $getter = as_path($self->path)->getter; |
24
|
30
|
|
|
|
|
811
|
my $mode = $self->mode; |
25
|
30
|
|
|
|
|
595
|
my $tester = $self->value_tester; |
26
|
30
|
100
|
|
|
|
145
|
if ($mode eq 'all') { |
|
|
50
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub { |
28
|
89
|
|
|
89
|
|
352
|
all_u {$tester->($_)} @{$getter->($_[0])}; |
|
88
|
|
|
|
|
584
|
|
|
89
|
|
|
|
|
1605
|
|
29
|
25
|
|
|
|
|
231
|
}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
elsif ($mode eq 'any') { |
32
|
|
|
|
|
|
|
sub { |
33
|
14
|
|
|
14
|
|
58
|
any {$tester->($_)} @{$getter->($_[0])}; |
|
15
|
|
|
|
|
47
|
|
|
14
|
|
|
|
|
259
|
|
34
|
5
|
|
|
|
|
48
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Catmandu::Fix::Condition::Builder::Simple - Helper role to easily write fix conditions that test a value |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |