| 1 | package HTML::FormHandler::Widget::Field::Compound; | ||||||||||||||||||||
| 2 | # ABSTRACT: compound field widget | ||||||||||||||||||||
| 3 | 55 | $HTML::FormHandler::Widget::Field::Compound::VERSION = '0.410001'; | |||||||||||||||||||
| 4 | 55 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | sub render_subfield { | ||||||||||||||||||||
| 8 | 119 | ▶ | my ( $self, $result, $subfield ) = @_; | ||||||||||||||||||
|
Subroutine
render_subfield: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 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 | sub render_element { | ||||||||||||||||||||
| 16 | 81 | ▶ | my ( $self, $result ) = @_; | ||||||||||||||||||
|
Subroutine
render_element: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 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 | sub render { | ||||||||||||||||||||
| 28 | 81 | ▶ | my ( $self, $result ) = @_; | ||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =pod | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =encoding UTF-8 | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =head1 NAME | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | HTML::FormHandler::Widget::Field::Compound - compound field widget | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | =head1 VERSION | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | version 0.410001 | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | =head1 SYNOPSIS | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | Widget for rendering a compound field. | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | =head1 AUTHOR | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | FormHandler Contributors - see HTML::FormHandler | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | This software is copyright (c) 2017 by Gerda Shank. | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 65 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||