| 1 | package HTML::FormHandler::Widget::Field::Text; | ||||||||||||||||||||
| 2 | # ABSTRACT: text field rendering widget | ||||||||||||||||||||
| 3 | 136 | $HTML::FormHandler::Widget::Field::Text::VERSION = '0.410001'; | |||||||||||||||||||
| 4 | 136 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 136 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 136 | ▶ | use HTML::FormHandler::Render::Util ('process_attrs'); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | sub render_element { | ||||||||||||||||||||
| 10 | 319 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
render_element: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||
| 11 | 319 | ▶ | my $result = shift || $self->result; | ||||||||||||||||||
|
Condition66%2/3
shift() || $self->result
MC/DC0%0/2
shift() || $self->result
shift()
$self->result
Truth table66%2/3
A || B
A= shift()B= $self->result
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 319 | my $t; | |||||||||||||||||||
| 14 | 319 | my $rendered = $self->html_filter($result->fif); | |||||||||||||||||||
| 15 | 319 | my $output = '<input type="' . $self->input_type . '" name="' | |||||||||||||||||||
| 16 | . $self->html_name . '" id="' . $self->id . '"'; | ||||||||||||||||||||
| 17 | 319 | ▶ | $output .= qq{ size="$t"} if $t = $self->size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 18 | 319 | ▶ | $output .= qq{ maxlength="$t"} if $t = $self->maxlength; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 19 | 319 | $output .= ' value="' . $self->html_filter($result->fif) . '"'; | |||||||||||||||||||
| 20 | 319 | $output .= process_attrs($self->element_attributes($result)); | |||||||||||||||||||
| 21 | 319 | $output .= ' />'; | |||||||||||||||||||
| 22 | 319 | return $output; | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | sub render { | ||||||||||||||||||||
| 26 | 317 | ▶ | my ( $self, $result ) = @_; | ||||||||||||||||||
|
Subroutine
render: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 27 | 317 | ▶ | $result ||= $self->result; | ||||||||||||||||||
|
Condition100%3/3
$result ||= $self->result
MC/DC100%2/2
$result ||= $self->result
$result
$self->result
Truth table100%3/3
A ||= B
A= $resultB= $self->result
| |||||||||||||||||||||
| 28 | 317 | ▶ | die "No result for form field '" . $self->full_name . "'. Field may be inactive." unless $result; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 316 | my $output = $self->render_element( $result ); | |||||||||||||||||||
| 30 | 316 | return $self->wrap_field( $result, $output ); | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 136 | 1; | |||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | __END__ | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | =pod | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | =encoding UTF-8 | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | =head1 NAME | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | HTML::FormHandler::Widget::Field::Text - text field rendering widget | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | =head1 VERSION | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | version 0.410001 | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | =head1 SYNOPSIS | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | Renders a text 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 | ||||||||||||||||||||