| 1 | 27 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | package HTML::FormFu::Role::Element::MultiElement; | ||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: multi-element role | ||||||||||||||||||||||||||||||||
| 5 | 27 | $HTML::FormFu::Role::Element::MultiElement::VERSION = '2.09'; | |||||||||||||||||||||||||||||||
| 6 | 27 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 27 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 2030 | ▶ | sub nested_names { | ||||||||||||||||||||||||||||||
|
Subroutine
nested_names: called CC=11 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 11 | 2030 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 2030 | ▶ | croak 'cannot set nested_names' if @_ > 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 2030 | ▶ | if ( defined $self->name ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 16 | 2030 | my @names; | |||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | # ignore immediate parent | ||||||||||||||||||||||||||||||||
| 19 | 2030 | my $parent = $self->parent; | |||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | 2030 | ▶ | while ( defined( $parent = $parent->parent ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | 2630 | ▶ | if ( $parent->can('is_field') && $parent->is_field ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$parent->can("is_field") and $parent->is_field
MC/DC0%0/2
$parent->can("is_field") and $parent->is_field
$parent->can("is_field")
$parent->is_field
Truth table66%2/3
A and B
A= $parent->can("is_field")B= $parent->is_field
| |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | # handling Field | ||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | push @names, $parent->name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | if defined $parent->name; | ||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||
| 29 | ▶ | elsif ( $parent->can('is_repeatable') && $parent->is_repeatable ) { | |||||||||||||||||||||||||||||||
|
Condition100%3/3
$parent->can("is_repeatable") and $parent->is_repeatable
MC/DC100%2/2
$parent->can("is_repeatable") and $parent->is_repeatable
$parent->can("is_repeatable")
$parent->is_repeatable
Truth table100%3/3
A and B
A= $parent->can("is_repeatable")B= $parent->is_repeatable
| |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | # handling Repeatable | ||||||||||||||||||||||||||||||||
| 32 | # ignore Repeatables nested_name attribute as it is provided | ||||||||||||||||||||||||||||||||
| 33 | # by the childrens Block elements | ||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||
| 35 | else { | ||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | # handling 'not Field' and 'not Repeatable' | ||||||||||||||||||||||||||||||||
| 38 | 2564 | ▶ | push @names, $parent->nested_name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 39 | if defined $parent->nested_name; | ||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 2030 | ▶ | if (@names) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 44 | 312 | return reverse(@names), $self->name; | |||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | 1718 | return ( $self->name ); | |||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub nested_base { | ||||||||||||||||||||||||||||||
|
Subroutine
nested_base: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 52 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | croak 'cannot set nested_base' if @_ > 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | # ignore immediate parent | ||||||||||||||||||||||||||||||||
| 57 | 0 | my $parent = $self->parent; | |||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | while ( defined( $parent = $parent->parent ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | return $parent->nested_name if defined $parent->nested_name; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | 27 | 1; | |||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | __END__ | ||||||||||||||||||||||||||||||||