| 1 | package HTML::FormHandler::Widget::Field::Compound; | ||||||||||||||||||||
| 2 | # ABSTRACT: compound field widget | ||||||||||||||||||||
| 3 | 55 | $HTML::FormHandler::Widget::Field::Compound::VERSION = '0.410002'; | |||||||||||||||||||
| 4 | 55 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 119 | ▶ | sub render_subfield { | ||||||||||||||||||
|
Subroutine
render_subfield: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 8 | 119 | my ( $self, $result, $subfield ) = @_; | |||||||||||||||||||
| 9 | 119 | my $subresult = $result->field( $subfield->name ); | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 119 | ▶ | return "" unless $subresult; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 12 | 119 | return $subfield->render( $subresult ); | |||||||||||||||||||
| 13 | } | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 81 | ▶ | sub render_element { | ||||||||||||||||||
|
Subroutine
render_element: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 16 | 81 | my ( $self, $result ) = @_; | |||||||||||||||||||
| 17 | 81 | ▶ | $result ||= $self->result; | ||||||||||||||||||
|
Condition33%1/3
$result ||= $self->result
MC/DC0%0/2
$result ||= $self->result
$result
$self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 81 | my $output = ''; | |||||||||||||||||||
| 20 | 81 | foreach my $subfield ( $self->sorted_fields ) { | |||||||||||||||||||
| 21 | 170 | $output .= $self->render_subfield( $result, $subfield ); | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | 81 | $output =~ s/^\n//; # remove newlines so they're not duplicated | |||||||||||||||||||
| 24 | 81 | return $output; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 81 | ▶ | sub render { | ||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 28 | 81 | my ( $self, $result ) = @_; | |||||||||||||||||||
| 29 | 81 | ▶ | $result ||= $self->result; | ||||||||||||||||||
|
Condition66%2/3
$result ||= $self->result
MC/DC0%0/2
$result ||= $self->result
$result
$self->result
Truth table66%2/3
A ||= B
A= $resultB= $self->result
| |||||||||||||||||||||
| 30 | 81 | ▶ | die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | 81 | my $output = $self->render_element( $result ); | |||||||||||||||||||
| 32 | 81 | return $self->wrap_field( $result, $output ); | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 55 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 36 | 55 | 1; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||