line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::error; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
103594
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
378
|
use Catmandu::Util qw(is_value); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
9
|
1
|
|
|
1
|
|
479
|
use Catmandu::Util::Path qw(:all); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
10
|
1
|
|
|
1
|
|
9
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
11
|
1
|
|
|
1
|
|
753
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has message => (fix_arg => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _build_fixer { |
18
|
4
|
|
|
4
|
|
40
|
my ($self) = @_; |
19
|
4
|
|
|
|
|
14
|
my $msg = $self->message; |
20
|
4
|
100
|
|
|
|
15
|
if (looks_like_path($msg)) { |
21
|
3
|
|
|
|
|
10
|
my $getter = as_path($msg)->getter; |
22
|
|
|
|
|
|
|
sub { |
23
|
3
|
|
|
3
|
|
7
|
my $data = $_[0]; |
24
|
3
|
|
|
|
|
50
|
my $vals = $getter->($data); |
25
|
3
|
100
|
|
|
|
25
|
@$vals || return $data; |
26
|
2
|
|
|
|
|
5
|
my $str = join "\n", grep {is_value($_)} @$vals; |
|
3
|
|
|
|
|
14
|
|
27
|
2
|
|
|
|
|
13
|
Catmandu::Error->throw($str); |
28
|
3
|
|
|
|
|
39
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
1
|
|
|
1
|
|
37
|
sub {Catmandu::Error->throw($msg)}; |
|
1
|
|
|
|
|
16
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Catmandu::Fix::error - die with an error message |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
unless exists(id) |
49
|
|
|
|
|
|
|
error('id missing!') |
50
|
|
|
|
|
|
|
end |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# get the value from a path |
53
|
|
|
|
|
|
|
error($.error) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SEE ALSO |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L<Catmandu::Fix> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|