1 package DX::ActionBuilder::UnsetValue;
3 use DX::Action::SetValue;
4 use DX::ActionBuilder::Normal;
5 use DX::Action::BindValue;
6 use DX::ActionBuilder::BoundValue;
7 use DX::Utils qw(VALUE_SET);
10 with 'DX::Role::ActionBuilder';
12 has target_path => (is => 'ro', required => 1, isa => ValuePath);
14 sub aperture_for_set_value {
15 [ [ VALUE_SET ,=> @{$_[0]->target_path} ] ]
18 sub action_for_set_value {
19 my ($self, $value) = @_;
20 if (my $p = $value->value_path) {
21 my $ab = DX::ActionBuilder::BoundValue->new(
22 target_path => $self->target_path,
23 rebind_path => $self->target_path,
25 inner_action_builder => $value->action_builder,
27 return DX::Action::BindValue->new(
28 target_path => $self->target_path,
29 new_value => $ab->apply_to_value($value, $value),
32 DX::ActionBuilder::Normal->new(
33 target_path => $self->target_path,
34 )->action_for_set_value($value);