| 1 | 25 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | package HTML::FormFu::Role::Element::MultiElement; | ||||||||||||||||||||||||||||||||
| 4 | 25 | $HTML::FormFu::Role::Element::MultiElement::VERSION = '2.06'; | |||||||||||||||||||||||||||||||
| 5 | 25 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 25 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | sub nested_names { | ||||||||||||||||||||||||||||||||
| 10 | 2030 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
nested_names: called CC=11 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 2030 | ▶ | croak 'cannot set nested_names' if @_ > 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | 2030 | ▶ | if ( defined $self->name ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 15 | 2030 | my @names; | |||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | # ignore immediate parent | ||||||||||||||||||||||||||||||||
| 18 | 2030 | my $parent = $self->parent; | |||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 2030 | ▶ | while ( defined( $parent = $parent->parent ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 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
| |||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | # handling Field | ||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | push @names, $parent->name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 26 | if defined $parent->name; | ||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||
| 28 | ▶ | 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
| |||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | # handling Repeatable | ||||||||||||||||||||||||||||||||
| 31 | # ignore Repeatables nested_name attribute as it is provided | ||||||||||||||||||||||||||||||||
| 32 | # by the childrens Block elements | ||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||
| 34 | else { | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | # handling 'not Field' and 'not Repeatable' | ||||||||||||||||||||||||||||||||
| 37 | 2564 | ▶ | push @names, $parent->nested_name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | if defined $parent->nested_name; | ||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 2030 | ▶ | if (@names) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 43 | 312 | return reverse(@names), $self->name; | |||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 1718 | return ( $self->name ); | |||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | sub nested_base { | ||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
nested_base: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | croak 'cannot set nested_base' if @_ > 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | # ignore immediate parent | ||||||||||||||||||||||||||||||||
| 56 | 0 | my $parent = $self->parent; | |||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | while ( defined( $parent = $parent->parent ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | return $parent->nested_name if defined $parent->nested_name; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 25 | 1; | |||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | =pod | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | HTML::FormFu::Role::Element::MultiElement | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | =head1 VERSION | ||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | version 2.06 | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | Carl Franks <cpan@fireartist.com> | ||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||
| 86 | This software is copyright (c) 2018 by Carl Franks. | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||
| 89 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | =cut | ||||||||||||||||||||||||||||||||