line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
840
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
7
|
use Catmandu::Util qw(is_number is_string is_bool); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
350
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
69
|
|
9
|
1
|
|
|
1
|
|
7
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
10
|
1
|
|
|
1
|
|
338
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
12
|
|
|
|
|
|
|
has strict => (fix_opt => 1); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition::Builder::Simple'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
if ($self->strict) { |
18
|
2
|
|
|
2
|
|
19
|
sub { |
19
|
2
|
100
|
|
|
|
11
|
is_bool($_[0]) && !$_[0]; |
20
|
|
|
|
|
|
|
}; |
21
|
5
|
100
|
|
5
|
|
15
|
} |
22
|
1
|
|
|
|
|
5
|
else { |
23
|
|
|
|
|
|
|
sub { |
24
|
|
|
|
|
|
|
my $val = $_[0]; |
25
|
|
|
|
|
|
|
(is_bool($val) && !$val) |
26
|
6
|
|
|
6
|
|
12
|
|| (is_number($val) && $val == 0) |
27
|
6
|
100
|
100
|
|
|
19
|
|| (is_string($val) && $val eq 'false'); |
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
7
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Catmandu::Fix::Condition::is_false - only execute fixes if all path values are the boolean false, 0 or "false" |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
if is_false(data.*.has_error) |
44
|
|
|
|
|
|
|
... |
45
|
|
|
|
|
|
|
end |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# strict only matches a real bool, not 0 or "0" or "false" |
48
|
|
|
|
|
|
|
if is_false(data.*.has_error, strict: 1) |
49
|
|
|
|
|
|
|
... |
50
|
|
|
|
|
|
|
end |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SEE ALSO |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L<Catmandu::Fix> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |