line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
712
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
6
|
use Catmandu::Util qw(is_number is_string is_bool); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
335
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
9
|
1
|
|
|
1
|
|
7
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
1
|
|
|
1
|
|
303
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
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
|
|
|
|
10
|
is_bool($_[0]) && !$_[0]; |
20
|
|
|
|
|
|
|
}; |
21
|
5
|
100
|
|
5
|
|
16
|
} |
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
|
|
|
18
|
|| (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 |