| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 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__; | ||||||||||