lib/Reaction/UI/WidgetClass/_OVER.pm

filter: Statementstmt 80.9% 17 / 21 Branchbran 25.0% 2 / 8 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 54.5% 24 / 44 CC 8 SCAR 19.7
CC
8
Cov
57%
each
9.7
BUILD
7.2
BEGIN
1.0
CRAP 7.2
« lib/Reaction/UI/ViewPort/Object.pm ↑ Summary lib/Reaction/Role/Meta/Attribute.pm »
1 package Reaction::UI::WidgetClass::_OVER;
2  
3 4 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 4 has 'collection' => (is => 'ro', required => 1);
9 20 ▶sub BUILD {
Subroutine BUILD: called CC=4 SCAR=19.7
Pod undocumented
10 20 my ($self, $args) = @_;
11 20 my $coll = $args->{collection};
12 20 ▶ unless (ref $coll eq 'ARRAY' || (blessed($coll) && $coll->can('next'))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $coll eq "ARRAY" or builtin::blessed($coll) and $coll->can("next")) 0 20 20
Condition16%1/6
ref $coll eq "ARRAY" or builtin::blessed($coll) and $coll->can("next")
l!l&&r!l&&!r
2000
builtin::blessed($coll) and $coll->can("next")
!ll&&!rl&&r
000
MC/DC0%0/3
ref $coll eq "ARRAY" or builtin::blessed($coll) and $coll->can("next")
ref $coll eq "ARRAY" builtin::blessed($coll) $coll->can("next")
Truth table25%1/4
A or B and C
A= ref $coll eq "ARRAY"B= builtin::blessed($coll)C= $coll->can("next")
ABCresult
1XX1
0111
00X0
0100
13 0 confess _OVER."->new collection arg ${coll} is neither"
14 ." arrayref nor implements next()";
15 }
16 };
17 20 ▶sub each {
Subroutine each: called CC=5 SCAR=22.7
Pod undocumented
18 20 my ($self, $do) = @_;
19 20 my $coll = $self->collection;
20 20 ▶ if (ref $coll eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $coll eq 'ARRAY') { } 20 0 20
21 20 foreach my $el (@$coll) {
22 319 $do->($el);
23 }
24 } else {
25 0 ▶ $coll->reset if $coll->can('reset');
Branch: 1 branch
BranchTrueFalseTotal
if $coll->can("reset") 0 0 0
26 0 ▶ while (my $el = $coll->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $el = $coll->next) 0 0 0
27 0 $do->($el);
28 }
29 }
30 };
31 4 __PACKAGE__->meta->make_immutable;
32  
33  
34 4 1;
« lib/Reaction/UI/ViewPort/Object.pm ↑ Summary lib/Reaction/Role/Meta/Attribute.pm »