Catmandu/Fix/Bind/importer.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 85.1% 40 / 47 CC 3 SCAR 6.6
CC
3
Cov
86%
bind
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« Catmandu/Fix/Parser.pm ↑ Summary Catmandu/Fix/Bind/maybe.pm »
1 package Catmandu::Fix::Bind::importer;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.2025';
6  
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Catmandu::Util qw(:is);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 with 'Catmandu::Fix::Bind', 'Catmandu::Fix::Bind::Group';
13  
14 1 has importer_name => (fix_arg => 1);
15 1 has step => (fix_opt => 1);
16 1 has importer_args => (fix_opt => 'collect');
17  
18 1 has importer => (is => 'lazy');
19  
20 3 ▶sub _build_importer {
Subroutine _build_importer: called CC=1 SCAR=0.0
21 3 my ($self) = @_;
22 3 Catmandu->importer($self->importer_name, %{$self->importer_args});
23 }
24  
25 3 ▶sub unit {
Subroutine unit: called CC=1 SCAR=0.0
Pod undocumented
26 3 my ($self, $data) = @_;
27 3 $data;
28 }
29  
30 3 ▶sub bind {
Subroutine bind: called CC=3 SCAR=14.2
Pod undocumented
31 3 my ($self, $mvar, $code) = @_;
32  
33 3 ▶ if ($self->step) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->step) { } 0 3 3
34 0 my $next = $self->importer->next;
35 0 ▶ $code->($next) if $next;
Branch: 1 branch
BranchTrueFalseTotal
if $next 0 0 0
36 }
37 else {
38 $self->importer->each(
39 sub {
40 $code->($_[0]);
41 }
42 3 );
43 }
44  
45 2 $mvar;
46 }
47  
48 1 1;
49  
50 __END__
« Catmandu/Fix/Parser.pm ↑ Summary Catmandu/Fix/Bind/maybe.pm »