lib/Reaction/UI/ViewPort/Field/Mutable/MatchingPasswords.pm

filter: Statementstmt 56.6% 17 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod n/a totaltotal 48.7% 20 / 41 CC 3 SCAR 12.1
CC
3
Cov
50%
__ANON__
6.0
__ANON__
6.0
_build_check_label
2.0
CRAP 3.3
« lib/Reaction/UI/RenderingContext/TT.pm ↑ Summary lib/Reaction/UI/Widget/Field/Mutable.pm »
1 package Reaction::UI::ViewPort::Field::Mutable::MatchingPasswords;
2  
3 1 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use MooseX::Types::Moose qw/Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 extends 'Reaction::UI::ViewPort::Field::Mutable::Password';
8  
9 1 has check_value => (is => 'rw', isa => Str, );
10 1 has check_label => (is => 'rw', isa => Str, lazy_build => 1);
11  
12 0 ▶sub _build_check_label {
Subroutine _build_check_label: not called CC=1 SCAR=6.9
13 0 my $orig_label = shift->label;
14 0 return "Confirm ${orig_label}";
15 }
16  
17 #maybe both check_value and value_string should have triggers ?
18 #that way if one even happens before the other it would still work?
19 0 ▶around adopt_value_string => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
20 0 my $orig = shift;
21 0 my ($self) = @_;
22 0 ▶ return $orig->(@_) if $self->check_value eq $self->value_string;
Branch: 1 branch
BranchTrueFalseTotal
if $self->check_value eq $self->value_string 0 0 0
23 0 $self->message("Passwords do not match");
24 0 return;
25 1 };
26  
27 #order is important check_value should happen before value here ...
28 #i don't like how this works, it's unnecessarily fragile, but how else ?
29 0 ▶around accept_events => sub { ('check_value', shift->(@_)) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
30  
31 0 ▶around can_sync_to_action => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
32 0 my $orig = shift;
33 0 my ($self) = @_;
34 0 ▶ return $orig->(@_) if $self->check_value eq $self->value_string;
Branch: 1 branch
BranchTrueFalseTotal
if $self->check_value eq $self->value_string 0 0 0
35 0 $self->message("Passwords do not match");
36 0 return;
37 1 };
38  
39 1 __PACKAGE__->meta->make_immutable;
40  
41 1 1;
42  
43 __END__;
« lib/Reaction/UI/RenderingContext/TT.pm ↑ Summary lib/Reaction/UI/Widget/Field/Mutable.pm »