Catalyst/Controller/HTML/FormFu/Action/FormConfig.pm

filter: Statementstmt 97.2% 35 / 36 Branchbran 70.0% 7 / 10 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 86.6% 52 / 60 CC 9 SCAR 19.2
CC
9
Cov
88%
execute
9.4
BEGIN
1.0
BEGIN
1.0
CRAP 6.8
« Catalyst/Controller/HTML/FormFu.pm ↑ Summary Catalyst/Controller/HTML/FormFu/Action/FormMethod.pm »
1 package Catalyst::Controller::HTML::FormFu::Action::FormConfig;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 our $VERSION = '2.04'; # VERSION
6 9 our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY
7  
8 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use Config::Any;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 9 extends 'Catalyst::Controller::HTML::FormFu::ActionBase::Form';
13  
14 18 ▶sub execute {
Subroutine execute: called CC=9 SCAR=22.4
Pod documented
15 18 my $self = shift;
16 18 my ( $controller, $c ) = @_;
17  
18 18 ▶ if ( $self->reverse =~ $self->_form_action_regex ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->reverse =~ $self->_form_action_regex) 12 6 18
19  
20 # don't load form again
21 12 return $self->next::method(@_);
22 }
23  
24 6 my $config = $controller->_html_formfu_config;
25  
26 return $self->next::method(@_)
27 unless exists $self->attributes->{ActionClass}
28 6 ▶ && $self->attributes->{ActionClass}[0] eq $config->{config_action};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->attributes->{"ActionClass"} and $self->attributes->{"ActionClass"}[0] eq $config->{"config_action"} 0 6 6
Condition33%1/3
exists $self->attributes->{"ActionClass"} and $self->attributes->{"ActionClass"}[0] eq $config->{"config_action"}
!ll&&!rl&&r
006
MC/DC0%0/2
exists $self->attributes->{"ActionClass"} and $self->attributes->{"ActionClass"}[0] eq $config->{"config_action"}
exists $self->attributes->{"ActionClass"} $self->attributes->{"ActionClass"}[0] eq $config->{"config_action"}
Truth table33%1/3
A and B
A= exists $self->attributes->{"ActionClass"}B= $self->attributes->{"ActionClass"}[0] eq $config->{"config_action"}
ABresult
0X0
100
111
29  
30 6 my $form = $controller->_form;
31 6 ▶ my @files = grep {length} split /\s+/, $self->{_attr_params}->[0] || '';
Condition100%2/2
$self->{'_attr_params'}[0] || ''
l!l
15
MC/DC100%1/1
$self->{'_attr_params'}[0] || ''
$self->{'_attr_params'}[0]
Truth table100%2/2
A
A= $self->{'_attr_params'}[0]
Aresult
11
00
32  
33 6 ▶ if ( !@files ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@files) 5 1 6
34 5 push @files, $self->reverse;
35 }
36  
37 6 my $ext_regex = $config->{_file_ext_regex};
38  
39 6 for my $file (@files) {
40 6 ▶ $c->log->debug( __PACKAGE__ . " loading config file '$file'" )
Branch: 1 branch
BranchTrueFalseTotal
if $c->debug 0 6 6
41 if $c->debug;
42  
43 6 ▶ if ( $file =~ m/ \. $ext_regex \z /x ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ / \. $ext_regex \z /x) { } 0 6 6
44 0 $form->load_config_file($file);
45 }
46 else {
47 6 $form->load_config_filestem($file);
48 }
49 }
50  
51 6 $form->process;
52  
53 6 $c->stash->{ $config->{form_stash} } = $form;
54  
55 6 $self->next::method(@_);
56 }
57  
58 9 1;
59  
60 __END__
« Catalyst/Controller/HTML/FormFu.pm ↑ Summary Catalyst/Controller/HTML/FormFu/Action/FormMethod.pm »