line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
610
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Catmandu::Util qw(check_code_ref); |
7
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
8
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Fix::Inlineable'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has code => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
default => sub { |
14
|
|
|
|
|
|
|
return sub { } |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
isa => \&check_code_ref, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around BUILDARGS => sub { |
20
|
|
|
|
|
|
|
my ($orig, $class, $code) = @_; |
21
|
|
|
|
|
|
|
$orig->($class, code => $code); |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my ($self, $data) = @_; |
25
|
|
|
|
|
|
|
$self->code->($data); |
26
|
3
|
|
|
3
|
0
|
51
|
} |
27
|
3
|
|
|
|
|
14
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=pod |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Catmandu::Fix::code - run arbitrary code as fix |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $fix = Catmandu::Fix::code->new( sub { |
40
|
|
|
|
|
|
|
my ($data) = @_; |
41
|
|
|
|
|
|
|
# ...do something |
42
|
|
|
|
|
|
|
return $data; |
43
|
|
|
|
|
|
|
}); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SEE ALSO |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
L<Catmandu::Fix::perlcode>, L<Catmandu::Fix::cmd> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |