1 package DX::Action::SetBoundValue;
3 use DX::Update::SetValue;
6 with 'DX::Role::Action';
8 has target_path => (is => 'ro', required => 1);
10 has rebind_path => (is => 'ro', required => 1);
12 has new_value => (is => 'ro', required => 1);
14 has inner_action => (is => 'ro', required => 1);
17 my ($self, $hyp) = @_;
18 my ($outer_hyp, @inner_events) = $self->inner_action->dry_run($hyp);
19 my ($scope, @events) = $outer_hyp->scope->apply_updates(
20 DX::Update::SetValue->new(
21 target_path => $self->target_path,
22 new_value => $self->new_value,
27 $targ = $targ->get_member_at($_) for @{$self->rebind_path};
30 my @actions = @{$outer_hyp->actions};
31 foreach my $idx (0.. $#actions) {
32 my $act = $actions[$idx];
34 $act->isa('DX::Action::BindValue')
35 and join("\0", @{$act->target_path})
36 eq join("\0", @{$self->rebind_path})
38 my $bind = splice @actions, $idx, 1;
39 push @actions, $bind->but(new_value => $new_bound);
44 $outer_hyp->but(scope => $scope, actions => \@actions),
45 @inner_events, @events