lib/Reaction/InterfaceModel/Action/DBIC/Result/Update.pm

filter: Statementstmt 100% 29 / 29 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 95.1% 39 / 41 CC 6 SCAR 11.0
CC
6
Cov
94%
BUILD
4.0
do_apply
3.0
BEGIN
1.0
CRAP 3.0
« lib/Reaction/UI/ViewPort/Field/Collection.pm ↑ Summary lib/Reaction/UI/View.pm »
1 package Reaction::InterfaceModel::Action::DBIC::Result::Update;
2  
3 5 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 extends 'Reaction::InterfaceModel::Action::DBIC::Result';
7 5 with 'Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques';
8  
9 6 ▶sub BUILD {
Subroutine BUILD: called CC=4 SCAR=13.9
Pod documented
10 6 my ($self) = @_;
11 6 my $tm = $self->target_model;
12 6 foreach my $attr ($self->parameter_attributes) {
13 23 my $writer = $attr->get_write_method;
14 23 my $name = $attr->name;
15 23 my $tm_attr = $tm->meta->find_attribute_by_name($name);
16 23 ▶ next unless ref $tm_attr;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $tm_attr 0 23 23
17 23 my $tm_reader = $tm_attr->get_read_method;
18 23 ▶ $self->$writer($tm->$tm_reader) if defined($tm->$tm_reader);
Branch: 1 branch
BranchTrueFalseTotal
if defined $tm->$tm_reader 18 5 23
19 }
20 }
21  
22 2 ▶sub do_apply {
Subroutine do_apply: called CC=3 SCAR=11.0
Pod documented
23 2 my $self = shift;
24 2 my $args = $self->parameter_hashref;
25 2 my $model = $self->target_model;
26 2 foreach my $name (keys %$args) {
27 8 my $tm_attr = $model->meta->find_attribute_by_name($name);
28 8 ▶ next unless ref $tm_attr;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $tm_attr 0 8 8
29 8 my $tm_writer = $tm_attr->get_write_method;
30 8 $model->$tm_writer($args->{$name});
31 }
32 2 $model->update;
33 2 return $model;
34 }
35  
36 5 __PACKAGE__->meta->make_immutable;
37  
38 5 1;
39  
40 __END__;
« lib/Reaction/UI/ViewPort/Field/Collection.pm ↑ Summary lib/Reaction/UI/View.pm »