line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
98
|
|
|
98
|
|
43792
|
|
|
98
|
|
|
|
|
191
|
|
|
98
|
|
|
|
|
561
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Fix; |
7
|
98
|
|
|
98
|
|
28167
|
use Catmandu::Util qw(is_value require_package); |
|
98
|
|
|
|
|
278
|
|
|
98
|
|
|
|
|
3407
|
|
8
|
98
|
|
|
98
|
|
618
|
use Moo::Role; |
|
98
|
|
|
|
|
206
|
|
|
98
|
|
|
|
|
5193
|
|
9
|
98
|
|
|
98
|
|
540
|
use namespace::clean; |
|
98
|
|
|
|
|
204
|
|
|
98
|
|
|
|
|
582
|
|
10
|
98
|
|
|
98
|
|
35522
|
|
|
98
|
|
|
|
|
188
|
|
|
98
|
|
|
|
|
611
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::Base'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has fixer => (is => 'lazy'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my ($self, $fixer) = @_; |
16
|
|
|
|
|
|
|
my $data_var = $fixer->var; |
17
|
557
|
|
|
557
|
0
|
1103
|
my $sub_var = $fixer->capture($self->fixer); |
18
|
557
|
|
|
|
|
8934
|
my $val = $self->_emit_call($sub_var, $data_var); |
19
|
557
|
|
|
|
|
10827
|
$self->_emit_assign($data_var, $val); |
20
|
557
|
|
|
|
|
1725
|
} |
21
|
557
|
|
|
|
|
1572
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Catmandu::Fix::Builder - Base role for Catmandu fixes |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This role expects a C<_build_fixer> method that produces a coderef that |
34
|
|
|
|
|
|
|
transforms the data. Used in combination with L<Catmandu::Path> |
35
|
|
|
|
|
|
|
implementations, data manipulations can be described in a relatively high-level |
36
|
|
|
|
|
|
|
way. Most fixes shipped with Catmandu work this way and can be used as a |
37
|
|
|
|
|
|
|
starting point to write your own fixes. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
package Catmandu::Fix::my_fix; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use Catmandu::Sane; |
44
|
|
|
|
|
|
|
use Moo; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _build_fixer { |
49
|
|
|
|
|
|
|
sub { |
50
|
|
|
|
|
|
|
my ($data) = @_; |
51
|
|
|
|
|
|
|
$data->{foo} = 'bar'; |
52
|
|
|
|
|
|
|
$data; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |