| 1 | package HTML::FormHandler::Widget::Field::Repeatable; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: repeatable field widget | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 28 | $HTML::FormHandler::Widget::Field::Repeatable::VERSION = '0.410000'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 28 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 28 | with 'HTML::FormHandler::Widget::Field::Compound'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 28 | has 'wrap_repeatable_element_method' => ( | |||||||||||||||||||||||||||||||||||||||||
| 9 | traits => ['Code'], | ||||||||||||||||||||||||||||||||||||||||||
| 10 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 11 | isa => 'CodeRef', | ||||||||||||||||||||||||||||||||||||||||||
| 12 | handles => { 'wrap_repeatable_element' => 'execute_method' }, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | sub render_subfield { | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 51 | ▶ | my ( $self, $result, $subfield ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_subfield: called CC=5 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 51 | my $subresult = $result->field( $subfield->name ); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 51 | ▶ | return "" unless $subresult | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$subresult or $self->has_flag("is_repeatable") and $subfield->name < $self->num_when_empty
$self->has_flag("is_repeatable") and $subfield->name < $self->num_when_empty
MC/DC0%0/3
$subresult or $self->has_flag("is_repeatable") and $subfield->name < $self->num_when_empty
$subresult
$self->has_flag("is_repeatable")
$subfield->name < $self->num_when_empty
Truth table25%1/4
A or B and C
A= $subresultB= $self->has_flag("is_repeatable")C= $subfield->name < $self->num_when_empty
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | or ( $self->has_flag( "is_repeatable") | ||||||||||||||||||||||||||||||||||||||||||
| 22 | and $subfield->name < $self->num_when_empty | ||||||||||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 51 | my $output = $subfield->render($subresult); | |||||||||||||||||||||||||||||||||||||||||
| 26 | 51 | ▶ | if ( $self->wrap_repeatable_element_method ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | $output = $self->wrap_repeatable_element($output, $subfield->name); | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 51 | return $output; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 28 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 28 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | HTML::FormHandler::Widget::Field::Repeatable - repeatable field widget | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | version 0.410000 | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | Renders a repeatable field | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | FormHandler Contributors - see HTML::FormHandler | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | This software is copyright (c) 2017 by Gerda Shank. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 62 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | =cut | ||||||||||||||||||||||||||||||||||||||||||