lib/HTML/FormFu/Role/Element/MultiElement.pm

filter: Statementstmt 78.5% 22 / 28 Branchbran 50.0% 11 / 22 Conditioncond 83.3% 5 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 2 totaltotal 65.6% 44 / 67 SCAR 30.2
CC
14
Cov
68%
nested_base
20.0
nested_names
12.1
BEGIN
1.0
CRAP 20.5
« lib/HTML/FormFu/Element/ComboBox.pm ↑ Summary lib/HTML/FormFu/QueryType/CGI/Simple.pm »
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
BranchTrueFalseTotal
if @_ > 1 0 2030 2030
13  
14 2030 ▶ if ( defined $self->name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->name) 2030 0 2030
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
BranchTrueFalseTotal
if (defined($parent = $parent->parent)) 2630 2030 4660
21  
22 2630 ▶ if ( $parent->can('is_field') && $parent->is_field ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($parent->can('is_field') and $parent->is_field) { } 0 2630 2630
elsif ($parent->can('is_repeatable') and $parent->is_repeatable) { } 66 2564 2630
Condition66%2/3
$parent->can("is_field") and $parent->is_field
!ll&&!rl&&r
20306000
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
ABresult
0X0
100
111
23  
24 # handling Field
25 0 ▶ push @names, $parent->name
Branch: 1 branch
BranchTrueFalseTotal
if defined $parent->name 0 0 0
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
!ll&&!rl&&r
203053466
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if defined $parent->nested_name 312 2252 2564
38 if defined $parent->nested_name;
39 }
40 }
41  
42 2030 ▶ if (@names) {
Branch: 1 branch
BranchTrueFalseTotal
if (@names) 312 1718 2030
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
BranchTrueFalseTotal
if @_ > 1 0 0 0
54  
55 # ignore immediate parent
56 0 my $parent = $self->parent;
57  
58 0 ▶ while ( defined( $parent = $parent->parent ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($parent = $parent->parent)) 0 0 0
59  
60 0 ▶ return $parent->nested_name if defined $parent->nested_name;
Branch: 1 branch
BranchTrueFalseTotal
if defined $parent->nested_name 0 0 0
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
« lib/HTML/FormFu/Element/ComboBox.pm ↑ Summary lib/HTML/FormFu/QueryType/CGI/Simple.pm »