format aperture in backtrack trace
[scpubgit/DX.git] / lib / DX / Role / Update.pm
CommitLineData
9d759b64 1package DX::Role::Update;
2
3use DX::Role;
4
2548ce61 5has target_path => (is => 'ro', required => 1, isa => ValuePath);
9d759b64 6
7sub _with_value_at_path {
8 my ($self, $scope, $final_value, @path) = @_;
efad53c4 9 return $final_value->($scope) unless @path;
9d759b64 10 my ($first, @rest) = @path;
9d759b64 11 my $inner = $scope->get_member_at($first);
12 my $value = (
13 @rest
14 ? $self->_with_value_at_path($inner, $final_value, @rest)
15 : $final_value->($inner)
16 );
17 $scope->with_member_at($first, $value);
18}
19
201;