line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
98
|
|
|
98
|
|
44470
|
|
|
98
|
|
|
|
|
191
|
|
|
98
|
|
|
|
|
564
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Fix; |
7
|
98
|
|
|
98
|
|
28389
|
use Catmandu::Util qw(is_value require_package); |
|
98
|
|
|
|
|
274
|
|
|
98
|
|
|
|
|
3453
|
|
8
|
98
|
|
|
98
|
|
617
|
use Moo::Role; |
|
98
|
|
|
|
|
263
|
|
|
98
|
|
|
|
|
5223
|
|
9
|
98
|
|
|
98
|
|
562
|
use namespace::clean; |
|
98
|
|
|
|
|
189
|
|
|
98
|
|
|
|
|
585
|
|
10
|
98
|
|
|
98
|
|
34974
|
|
|
98
|
|
|
|
|
209
|
|
|
98
|
|
|
|
|
642
|
|
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
|
1034
|
my $sub_var = $fixer->capture($self->fixer); |
18
|
557
|
|
|
|
|
8806
|
my $val = $self->_emit_call($sub_var, $data_var); |
19
|
557
|
|
|
|
|
10553
|
$self->_emit_assign($data_var, $val); |
20
|
557
|
|
|
|
|
1657
|
} |
21
|
557
|
|
|
|
|
1483
|
|
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 |