lib/Reaction/UI/Widget/Container.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 6 / 6 Conditioncond 55.5% 5 / 9 MC/DCmcdc 33.3% 2 / 6 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 88.2% 60 / 68 CC 9 SCAR 10.7
CC
9
Cov
93%
__ANON__
4.0
__ANON__
4.0
__ANON__
3.1
CRAP 2.9
« lib/Reaction/UI/View.pm ↑ Summary lib/Reaction/UI/FocusStack.pm »
1 package Reaction::UI::Widget::Container;
2  
3 3 ▶use Reaction::UI::WidgetClass;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use aliased 'Reaction::UI::ViewPort';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 3 our $child_name;
11  
12 # somewhat evil. fragment returns ($name, $code) to pass to implements
13 # or a method modifier name, so [1] will get us just the code
14  
15 # This is convenient to do here but DO NOT duplicate this code outside of
16 # the same dist as WidgetClass since it's internals-dependent.
17  
18 4 ▶my $child_fragment_method
Subroutine __ANON__: called CC=1 SCAR=0.0
19 4 = (fragment container_child {
20 4 arg '_' => $_{viewport}->$child_name;
21 3 render 'viewport';
22 })[1];
23 56 ▶ 
Subroutine __ANON__: called CC=4 SCAR=14.0
24 56 around _method_for_fragment_name => sub {
25 56 my $orig = shift;
26 56 my $self = shift;
27 56 ▶ my ($fragment_name) = @_;
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Reaction::UI::Widget::Container::child_name and $fragment_name eq $Reaction::UI::Widget::Container::child_name) 4 52 56
Condition100%3/3
defined $Reaction::UI::Widget::Container::child_name and $fragment_name eq $Reaction::UI::Widget::Container::child_name
!ll&&!rl&&r
4844
MC/DC100%2/2
defined $Reaction::UI::Widget::Container::child_name and $fragment_name eq $Reaction::UI::Widget::Container::child_name
defined $Reaction::UI::Widget::Container::child_name $fragment_name eq $Reaction::UI::Widget::Container::child_name
Truth table100%3/3
A and B
A= defined $Reaction::UI::Widget::Container::child_nameB= $fragment_name eq $Reaction::UI::Widget::Container::child_name
ABresult
0X0
100
111
28 if (defined($child_name)
29 4 ▶ && $fragment_name eq $child_name) {
Condition33%1/3
$self->$orig(@_) || $child_fragment_method
l!l&&r!l&&!r
040
MC/DC0%0/2
$self->$orig(@_) || $child_fragment_method
$self->$orig(@_) $child_fragment_method
Truth table33%1/3
A || B
A= $self->$orig(@_)B= $child_fragment_method
ABresult
1X1
011
000
30 return $self->$orig(@_) || $child_fragment_method;
31 52 }
32 3 return $self->$orig(@_);
33 };
34 4 ▶
Subroutine __ANON__: called CC=3 SCAR=11.3
35 4 before _fragment_widget => sub {
36 4 my ($self, $do_render, $args, $new_args) = @_;
37 4 my @contained_names = $self->_contained_names($args->{viewport});
38 4 ▶ foreach my $name (@contained_names) {
Subroutine __ANON__: called CC=1 SCAR=0.0
39 4 $new_args->{$name} ||= sub {
40 4 local $child_name = $name;
41 4 ▶ $self->render($name, @_);
Condition33%1/3
$new_args->{$name} ||= sub { local $child_name = $name; $self->render($name, @_); }
l!l&&r!l&&!r
040
MC/DC0%0/2
$new_args->{$name} ||= sub { local $child_name = $name; $self->render($name, @_); }
$new_args->{$name} sub { local $child_name = $name; $self->render($name, @_); }
Truth table33%1/3
A ||= B
A= $new_args->{$name}B= sub { local $child_name = $name; $self->render($name, @_); }
ABresult
1X1
011
000
42 };
43 3 }
44 };
45 4 ▶ 
Subroutine __ANON__: called CC=4 SCAR=13.9
46 4 implements _contained_names => sub {
47 4 my ($self, $vp) = @_;
48 4 my @names;
49 44 ▶ foreach my $attr ($vp->meta->get_all_attributes) {
Branch: 1 branch
BranchTrueFalseTotal
unless eval { do { $attr->type_constraint->name->isa("Reaction::UI::ViewPort") } } 36 8 44
50 8 next unless eval { $attr->type_constraint->name->isa(ViewPort) };
51 8 ▶ my $name = $attr->name;
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "outer" 4 4 8
52 4 next if ($name eq 'outer');
53 push(@names, $name);
54 4 }
55 3 return @names;
56 };
57 3  
58 __PACKAGE__->meta->make_immutable;
59 3  
60 1;
61  
62 __END__
« lib/Reaction/UI/View.pm ↑ Summary lib/Reaction/UI/FocusStack.pm »