blib/lib/Catmandu/Fix/code.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 85.1% 23 / 27 CC 1 SCAR 1.3
CC
1
Cov
95%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/Catmandu/ArrayIterator.pm ↑ Summary blib/lib/Catmandu/Fix/join_field.pm »
1 package Catmandu::Fix::code;
2  
3 2 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 our $VERSION = '1.0201_02';
6  
7 2 ▶use Catmandu::Util qw(check_code_ref);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 with 'Catmandu::Fix::Inlineable';
11  
12 has code => (
13 is => 'ro',
14 default => sub {
15 ▶ return sub { }
Subroutine __ANON__: not called CC=1 SCAR=0.0
16 0 ▶ },
Subroutine __ANON__: not called CC=1 SCAR=6.9
17 2 isa => \&check_code_ref,
18 );
19  
20 around BUILDARGS => sub {
21 9 ▶ my ($orig, $class, $code) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
22 9 $orig->($class, code => $code);
23 2 };
24  
25 sub fix {
26 723 ▶ my ($self, $data) = @_;
Subroutine fix: called CC=1 SCAR=0.0
Pod undocumented
27 723 $self->code->($data);
28 }
29  
30 2 1;
31  
32 __END__
33  
34 =pod
35  
36 =head1 NAME
37  
38 Catmandu::Fix::code - run arbitrary code as fix
39  
40 =head1 SYNOPSIS
41  
42 my $fix = Catmandu::Fix::code->new( sub {
43 my ($data) = @_;
44 # ...do something
45 return $data;
46 });
47  
48 =head1 SEE ALSO
49  
50 L<Catmandu::Fix::perlcode>, L<Catmandu::Fix::cmd>
51  
52 =cut
« blib/lib/Catmandu/ArrayIterator.pm ↑ Summary blib/lib/Catmandu/Fix/join_field.pm »