lib/HTML/FormFu/Element/Password.pm

filter: Statementstmt 100% 33 / 33 Branchbran 100% 8 / 8 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 96.4% 55 / 57 CC 7 SCAR 15.0
CC
7
Cov
98%
process_value
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
« lib/HTML/FormFu/Element/URL.pm ↑ Summary lib/HTML/FormFu/Role/Populate.pm »
1 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Element::Password;
4 8 $HTML::FormFu::Element::Password::VERSION = '2.09';
5 # ABSTRACT: Password form field
6  
7 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use MooseX::Attribute::Chained;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 extends 'HTML::FormFu::Element';
11  
12 8 with 'HTML::FormFu::Role::Element::Input';
13  
14 8 ▶use HTML::FormFu::Constants qw( $EMPTY_STR );
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 8 has render_value => ( is => 'rw', traits => ['Chained'] );
17  
18 9 ▶after BUILD => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
19 9 my $self = shift;
20  
21 9 $self->field_type('password');
22  
23 9 return;
24 8 };
25  
26 12 ▶sub process_value {
Subroutine process_value: called CC=7 SCAR=19.5
27 12 my ( $self, $value ) = @_;
28  
29 12 my $submitted = $self->form->submitted;
30 12 my $new;
31  
32 12 ▶ if ( $submitted && $self->render_value ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($submitted and $self->render_value) { } 5 7 12
elsif ($submitted) { } 3 4 7
Condition100%3/3
$submitted and $self->render_value
!ll&&!rl&&r
435
MC/DC100%2/2
$submitted and $self->render_value
$submitted $self->render_value
Truth table100%3/3
A and B
A= $submittedB= $self->render_value
ABresult
0X0
100
111
33 5 ▶ $new
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 3 2 5
34 = defined $value
35 ? $value
36 : $EMPTY_STR;
37  
38 5 ▶ if ( $self->retain_default && $new eq $EMPTY_STR ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->retain_default and $new eq $HTML::FormFu::Element::Password::EMPTY_STR) 2 3 5
Condition66%2/3
$self->retain_default and $new eq $HTML::FormFu::Element::Password::EMPTY_STR
!ll&&!rl&&r
302
MC/DC50%1/2
$self->retain_default and $new eq $HTML::FormFu::Element::Password::EMPTY_STR
$self->retain_default $new eq $HTML::FormFu::Element::Password::EMPTY_STR
Truth table66%2/3
A and B
A= $self->retain_defaultB= $new eq $HTML::FormFu::Element::Password::EMPTY_STR
ABresult
0X0
100
111
39 2 $new = $self->value;
40 }
41  
42 5 $self->value($new);
43 }
44 elsif ($submitted) {
45 3 $new = $EMPTY_STR;
46 }
47 else {
48 4 $new = undef;
49 }
50  
51 12 return $new;
52 }
53  
54 8 __PACKAGE__->meta->make_immutable;
55  
56 8 1;
57  
58 __END__
« lib/HTML/FormFu/Element/URL.pm ↑ Summary lib/HTML/FormFu/Role/Populate.pm »