sub with_value {
my ($self, $value) = @_;
- return ref($self)->new(
- %$self,
- values => { %{$self->values}, $value->${\$self->over} => $value }
- );
+ return ref($self)->new(%$self, values => { %{$self->values} })
+ ->set_value($value);
+}
+
+sub set_value {
+ my ($self, $value) = @_;
+ $self->values->{$value->${\$self->over}} = $value;
+ return $self;
}
1;