| 1 | package Rose::HTML::Form::Field::Text; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 17 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 17 | ▶ | use Encode; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 17 | ▶ | use Rose::HTML::Object::Errors qw(:string); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 17 | ▶ | use base 'Rose::HTML::Form::Field::Input'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 17 | our $VERSION = '0.606'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 17 | __PACKAGE__->delete_valid_html_attrs(qw(ismap usemap alt src)); | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 17 | __PACKAGE__->add_required_html_attrs( | |||||||||||||||||||||||||||
| 15 | { | ||||||||||||||||||||||||||||
| 16 | type => 'text', | ||||||||||||||||||||||||||||
| 17 | name => '', | ||||||||||||||||||||||||||||
| 18 | size => 15, | ||||||||||||||||||||||||||||
| 19 | value => '', | ||||||||||||||||||||||||||||
| 20 | }); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub html_field | ||||||||||||||||||||||||||||
| 23 | 145 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
html_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 145 | my($self) = shift; | |||||||||||||||||||||||||||
| 25 | 145 | $self->html_attr(value => $self->output_value); | |||||||||||||||||||||||||||
| 26 | 145 | return $self->SUPER::html_field(@_); | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub xhtml_field | ||||||||||||||||||||||||||||
| 30 | 98 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
xhtml_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 98 | my($self) = shift; | |||||||||||||||||||||||||||
| 32 | 98 | $self->html_attr(value => $self->output_value); | |||||||||||||||||||||||||||
| 33 | 98 | return $self->SUPER::xhtml_field(@_); | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | sub validate | ||||||||||||||||||||||||||||
| 37 | 134 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
validate: called CC=9 SCAR=22.2
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 134 | my($self) = shift; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 134 | my $ok = $self->SUPER::validate(@_); | |||||||||||||||||||||||||||
| 41 | 134 | ▶ | return $ok unless($ok); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 123 | my $value = $self->input_value; | |||||||||||||||||||||||||||
| 44 | 123 | ▶ | $value = $self->output_value if(ref $value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 123 | ▶ | return 1 unless(defined $value && length $value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $value and length $value
MC/DC100%2/2
defined $value and length $value
defined $value
length $value
Truth table100%3/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 97 | my $maxlength = $self->maxlength; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my $name = sub { $self->error_label || $self->name }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 97 | ▶ | if(ref($self)->force_utf8 && !Encode::is_utf8($value)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref($self)->force_utf8 and not &Encode::is_utf8($value)
MC/DC50%1/2
ref($self)->force_utf8 and not &Encode::is_utf8($value)
ref($self)->force_utf8
not &Encode::is_utf8($value)
Truth table66%2/3
A and not(B)
A= ref($self)->force_utf8B= not &Encode::is_utf8($value)
| |||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 1 | Encode::_utf8_on($value); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 97 | ▶ | if(defined $maxlength && length($value) > $maxlength) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $maxlength and length $value > $maxlength
MC/DC100%2/2
defined $maxlength and length $value > $maxlength
defined $maxlength
length $value > $maxlength
Truth table100%3/3
A and B
A= defined $maxlengthB= length $value > $maxlength
| |||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||
| 58 | 3 | $self->add_error_id(STRING_OVERFLOW, { label => $name, maxlength => $maxlength }); | |||||||||||||||||||||||||||
| 59 | 3 | return 0; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 94 | return 1; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 17 | ▶ | if(__PACKAGE__->localizer->auto_load_messages) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||
| 67 | 0 | __PACKAGE__->localizer->load_all_messages; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 17 | ▶ | use utf8; # The __DATA__ section contains UTF-8 text | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 17 | 1; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | __DATA__ | ||||||||||||||||||||||||||||