blib/lib/Catalyst/Plugin/FormValidator/Simple.pm

filter: Statementstmt 31.5% 12 / 38 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 42.8% 3 / 7 Podpod 50.0% 2 / 4 totaltotal 19.3% 17 / 88 CC 13 SCAR 43.7
CC
13
Cov
18%
setup
132.0
form
12.0
prepare
2.0
CRAP 78.7
↑ Summary
1 package Catalyst::Plugin::FormValidator::Simple;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use base qw/Catalyst::Plugin::FormValidator/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 # doesn't use parent module at all, but this is required for Catalyst::Plugin::FillInForm
5  
6 1 ▶use MRO::Compat;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 require FormValidator::Simple;
8  
9 1 our $VERSION = '0.15';
10  
11 0 ▶sub setup {
Subroutine setup: not called CC=11 SCAR=48.8
Pod undocumented
12 0 my $self = shift;
13 0 $self->maybe::next::method(@_);
14 0 my $setting = $self->config->{validator};
15 my $plugins = $setting && exists $setting->{plugins}
16 ? $setting->{plugins}
17 0 ▶ : [];
Branch: 1 branch
BranchTrueFalseTotal
$setting && exists $setting->{'plugins'} ? : 0 0 0
Condition0%0/3
$setting and exists $setting->{"plugins"}
!ll&&!rl&&r
000
MC/DC0%0/2
$setting and exists $setting->{"plugins"}
$setting exists $setting->{"plugins"}
Truth table0%0/3
A and B
A= $settingB= exists $setting->{"plugins"}
ABresult
0X0
100
111
18 0 FormValidator::Simple->import(@$plugins);
19 0 ▶ if ( $setting && exists $setting->{messages} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($setting and exists $setting->{"messages"}) 0 0 0
Condition0%0/3
$setting and exists $setting->{"messages"}
!ll&&!rl&&r
000
MC/DC0%0/2
$setting and exists $setting->{"messages"}
$setting exists $setting->{"messages"}
Truth table0%0/3
A and B
A= $settingB= exists $setting->{"messages"}
ABresult
0X0
100
111
20 0 FormValidator::Simple->set_messages( $setting->{messages} );
21 }
22 0 ▶ if ( $setting && exists $setting->{options} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($setting and exists $setting->{"options"}) 0 0 0
Condition0%0/3
$setting and exists $setting->{"options"}
!ll&&!rl&&r
000
MC/DC0%0/2
$setting and exists $setting->{"options"}
$setting exists $setting->{"options"}
Truth table0%0/3
A and B
A= $settingB= exists $setting->{"options"}
ABresult
0X0
100
111
23 0 FormValidator::Simple->set_option( %{ $setting->{options} } );
24 }
25 0 ▶ if ( $setting && exists $setting->{message_format} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($setting and exists $setting->{"message_format"}) 0 0 0
Condition0%0/3
$setting and exists $setting->{"message_format"}
!ll&&!rl&&r
000
MC/DC0%0/2
$setting and exists $setting->{"message_format"}
$setting exists $setting->{"message_format"}
Truth table0%0/3
A and B
A= $settingB= exists $setting->{"message_format"}
ABresult
0X0
100
111
26 0 FormValidator::Simple->set_message_format( $setting->{message_format} );
27 }
28 0 ▶ if ( $setting && exists $setting->{message_decode_from} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($setting and exists $setting->{"message_decode_from"}) 0 0 0
Condition0%0/3
$setting and exists $setting->{"message_decode_from"}
!ll&&!rl&&r
000
MC/DC0%0/2
$setting and exists $setting->{"message_decode_from"}
$setting exists $setting->{"message_decode_from"}
Truth table0%0/3
A and B
A= $settingB= exists $setting->{"message_decode_from"}
ABresult
0X0
100
111
29 0 FormValidator::Simple->set_message_decode_from( $setting->{message_decode_from} );
30 }
31 }
32  
33 0 ▶sub prepare {
Subroutine prepare: not called CC=1 SCAR=6.9
Pod documented
34 0 my $c = shift;
35 0 $c = $c->maybe::next::method(@_);
36 0 $c->{validator} = FormValidator::Simple->new;
37 0 return $c;
38 }
39  
40 0 ▶sub form {
Subroutine form: not called CC=3 SCAR=24.8
Pod documented
41 0 my $c = shift;
42 0 ▶ if ($_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 0 0 0
43 0 ▶ my $form = $_[1] ? [@_] : $_[0];
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 0 0 0
44 0 $c->{validator}->check($c->req, $form);
45 }
46 0 return $c->{validator}->results;
47 }
48  
49 0 ▶sub set_invalid_form {
Subroutine set_invalid_form: not called CC=1 SCAR=6.9
Pod undocumented
50 0 my $c = shift;
51 0 $c->{validator}->set_invalid(@_);
52 0 return $c->{validator}->results;
53 }
54  
55 1 1;
56 __END__
↑ Summary