lib/Reaction/InterfaceModel/Search/UpdateSpec.pm

filter: Statementstmt 32.7% 18 / 55 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 55.5% 5 / 9 Podpod n/a totaltotal 27.7% 23 / 83 CC 12 SCAR 34.8
CC
12
Cov
26%
__ANON__
72.0
__ANON__
11.0
do_apply
11.0
CRAP 32.5
« lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm ↑ Summary lib/Reaction/UI/ViewPort/Role/Actions.pm »
1 package Reaction::InterfaceModel::Search::UpdateSpec;
2  
3 4 ▶use Reaction::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Method::Signatures::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use aliased 'Reaction::InterfaceModel::Search::Spec', 'SearchSpec';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # FIXME - has '+attr' broken, copied from Reaction::InterfaceModel::Action
9 #has '+target_model' => (isa => SearchSpec);
10 2 has target_model => (
11 isa => SearchSpec,
12 is => 'ro',
13 required => 1,
14 metaclass => 'Reaction::Meta::Attribute'
15 );
16  
17 2 requires '_reflection_info';
18  
19 0 ▶override BUILDARGS => method () {
Subroutine __ANON__: not called CC=8 SCAR=42.8
20 0 my $args = super;
21 0 my $model = $args->{target_model};
22 0 my $reflected = $self->_reflection_info;
23 0 ▶ foreach my $attr (@{$reflected->{empty}||[]}) {
Condition0%0/2
$reflected->{'empty'} || []
l!l
00
MC/DC0%0/1
$reflected->{'empty'} || []
$reflected->{'empty'}
Truth table0%0/2
A
A= $reflected->{'empty'}
Aresult
11
00
24 0 ▶ if ($model->${\"has_${attr}"}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($model->${\("has_$attr");}) { } 0 0 0
25 0 $args->{$attr} = $model->$attr;
26 } else {
27 0 $args->{$attr} = '';
28 }
29 }
30 0 ▶ foreach my $attr (@{$reflected->{normal}||[]}) {
Condition0%0/2
$reflected->{'normal'} || []
l!l
00
MC/DC0%0/1
$reflected->{'normal'} || []
$reflected->{'normal'}
Truth table0%0/2
A
A= $reflected->{'normal'}
Aresult
11
00
31 0 ▶ my $has = $model->can("has_${attr}")||sub {1};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$model->can("has_$attr") || sub { 1; }
l!l&&r!l&&!r
000
MC/DC0%0/2
$model->can("has_$attr") || sub { 1; }
$model->can("has_$attr") sub { 1; }
Truth table0%0/3
A || B
A= $model->can("has_$attr")B= sub { 1; }
ABresult
1X1
011
000
32 0 ▶ $args->{$attr} = $model->$attr if $model->$has;
Branch: 1 branch
BranchTrueFalseTotal
if $model->$has 0 0 0
33 }
34 0 $args;
35 2 };
36  
37 0 ▶method do_apply () {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine do_apply: not called CC=3 SCAR=23.9
Subroutine __ANON__: not called CC=3 SCAR=23.9
38 0 my $data = $self->parameter_hashref;
39 0 my $spec = $self->target_model;
40 0 foreach my $name (keys %$data) {
41 # note: this assumes plain is => 'rw' attrs on the backend
42 # which is safe since we control it. Also, we assume '' means
43 # clear - this may not be safe later but is for now
44 0 ▶ if (length(my $value = $data->{$name})) {
Branch: 2 branches
BranchTrueFalseTotal
if (length(my $value = $data->{$name})) { } 0 0 0
if (length(my $value = $data->{$name})) { } 0 0 0
45 0 $spec->$name($value);
46 } else {
47 0 $spec->${\"clear_${name}"};
48 }
49 }
50 0 $spec;
51 2 }
52  
53 2 1;
54  
« lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm ↑ Summary lib/Reaction/UI/ViewPort/Role/Actions.pm »