Declare/Runner.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 3 totaltotal 82.0% 41 / 50 CC 4 SCAR 5.7
CC
4
Cov
89%
rows
3.4
add_reader_to_bucket
2.0
BEGIN
1.0
CRAP 1.8
« Declare/Reader.pm ↑ Summary
1 package Test::MasterData::Declare::Runner;
2 4 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Class::Accessor::Lite (
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 new => 1,
9 rw => [qw/bucket/],
10 ro => [qw/code/],
11 4 );
12  
13 4 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 ▶sub run {
Subroutine run: called CC=1 SCAR=0.0
Pod undocumented
16 3 my $self = shift;
17  
18 3 $self->code->();
19 }
20  
21 5 ▶sub add_reader_to_bucket {
Subroutine add_reader_to_bucket: called CC=2 SCAR=6.9
Pod undocumented
22 5 my ($self, $reader) = @_;
23  
24 5 ▶ $self->bucket({}) unless $self->bucket;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->bucket 3 2 5
25  
26 # TODO: merge reader
27 5 $self->bucket->{$reader->table_name} = $reader;
28 }
29  
30 7 ▶sub rows {
Subroutine rows: called CC=3 SCAR=12.3
Pod undocumented
31 7 my ($self, $table_name) = @_;
32  
33 7 ▶ if (!defined $self->bucket || !exists $self->bucket->{$table_name}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->bucket and exists $self->bucket->{$table_name}) 0 7 7
Condition33%1/3
defined $self->bucket and exists $self->bucket->{$table_name}
!ll&&!rl&&r
007
MC/DC0%0/2
defined $self->bucket and exists $self->bucket->{$table_name}
defined $self->bucket exists $self->bucket->{$table_name}
Truth table33%1/3
A and B
A= defined $self->bucketB= exists $self->bucket->{$table_name}
ABresult
0X0
100
111
34 0 croak "$table_name is not exists.";
35 }
36 7 my $reader = $self->bucket->{$table_name};
37 7 my $rows = $reader->rows;
38 7 return $rows;
39 }
40  
41 4 1;
« Declare/Reader.pm ↑ Summary