Form/TextInput.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 10 / 10 Conditioncond 91.6% 11 / 12 MC/DCmcdc 83.3% 5 / 6 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 94.0% 47 / 50 CC 10 SCAR 21.4
CC
10
Cov
98%
value
10.0
BEGIN
1.0
BEGIN
1.0
CRAP 8.5
« Form/ListInput.pm ↑ Summary Form/FileInput.pm »
1 package HTML::Form::TextInput;
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use parent 'HTML::Form::Input';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 our $VERSION = '6.13';
7  
8 # ABSTRACT: An HTML form text input element for use with HTML::Form
9  
10 #input/text
11 #input/password
12 #input/hidden
13 #textarea
14  
15 116 ▶sub value {
Subroutine value: called CC=10 SCAR=23.0
Pod undocumented
16 116 my $self = shift;
17 116 my $old = $self->{value};
18 116 ▶ $old = "" unless defined $old;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $old 36 80 116
19 116 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 24 92 116
20 Carp::croak("Input '$self->{name}' is readonly")
21 24 ▶ if $self->{strict} && $self->{readonly};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"strict"} and $self->{"readonly"} 2 22 24
Condition100%3/3
$self->{"strict"} and $self->{"readonly"}
!ll&&!rl&&r
1842
MC/DC100%2/2
$self->{"strict"} and $self->{"readonly"}
$self->{"strict"} $self->{"readonly"}
Truth table100%3/3
A and B
A= $self->{"strict"}B= $self->{"readonly"}
ABresult
0X0
100
111
22 22 my $new = shift;
23 22 ▶ my $n = exists $self->{maxlength} ? $self->{maxlength} : undef;
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'maxlength'} ? : 4 18 22
24 Carp::croak("Input '$self->{name}' has maxlength '$n'")
25 if $self->{strict}
26 22 ▶ && defined($n)
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"strict"} and defined $n and defined $new and length $new > $n 1 21 22
Condition88%8/9
$self->{"strict"} and defined $n and defined $new and length $new > $n
!ll&&!rl&&r
2011
$self->{"strict"} and defined $n and defined $new
!ll&&!rl&&r
2002
$self->{"strict"} and defined $n
!ll&&!rl&&r
1822
MC/DC75%3/4
$self->{"strict"} and defined $n and defined $new and length $new > $n
$self->{"strict"} defined $n defined $new length $new > $n
Truth table80%4/5
A and B and C and D
A= $self->{"strict"}B= defined $nC= defined $newD= length $new > $n
ABCDresult
0XXX0
10XX0
110X0
11100
11111
27 && defined($new)
28 && length($new) > $n;
29 21 $self->{value} = $new;
30 }
31 113 $old;
32 }
33  
34 11 1;
35  
36 __END__
« Form/ListInput.pm ↑ Summary Form/FileInput.pm »