| 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
Condition100%3/3
defined $Reaction::UI::Widget::Container::child_name and $fragment_name eq $Reaction::UI::Widget::Container::child_name
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
| |||||||||||||||||||||||||||||
| 28 | if (defined($child_name) | ||||||||||||||||||||||||||||
| 29 | 4 | ▶ | && $fragment_name eq $child_name) { | ||||||||||||||||||||||||||
|
Condition33%1/3
$self->$orig(@_) || $child_fragment_method
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
| |||||||||||||||||||||||||||||
| 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, @_);
}
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, @_);
}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 50 | 8 | next unless eval { $attr->type_constraint->name->isa(ViewPort) }; | |||||||||||||||||||||||||||
| 51 | 8 | ▶ | my $name = $attr->name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||