QBit/WebInterface/Controller/Form/Field/input.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 7 SCAR 32.9
CC
7
Cov
0%
control_html
42.0
init
6.0
BEGIN
2.0
CRAP 26.8
1 package QBit::WebInterface::Controller::Form::Field::input;
2 $QBit::WebInterface::Controller::Form::Field::input::VERSION = '0.033';
3 use qbit;
4  
5 use base qw(QBit::WebInterface::Controller::Form::Field);
6  
7 sub init {
8 my ($self) = @_;
9  
10 $self->SUPER::init();
11  
12 $self->{'input_type'} = 'text' unless defined($self->{'type'});
13 }
14  
15 sub control_html {
16 my ($self) = @_;
17  
18 my $html = '<input type="' . html_encode($self->{'input_type'}) . '"';
19 $html .= $self->_class('span9');
20  
21 foreach (qw(id name style maxlength)) {
22 $html .= " $_=\"" . html_encode($self->{$_}) . '"' if defined($self->{$_});
23 }
24  
25 $html .= ' value="' . html_encode($self->value) . '"' if defined($self->value);
26  
27 $html .= ' checked="checked"' if $self->{'checked'};
28  
29 $html .=
30 ' placeholder="'
31 . html_encode(ref($self->{'placeholder'}) eq 'CODE' ? $self->{'placeholder'}() : $self->{'placeholder'}) . '"'
32 if defined($self->{'placeholder'});
33  
34 $html .= ' />';
35  
36 $html .= $self->_html_error();
37  
38 return $html;
39 }
40  
41 TRUE;