AI-ExpertSystem-Advanced

 view release on metacpan or  search on metacpan

lib/AI/ExpertSystem/Advanced/Dictionary.pm  view on Meta::CPAN

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
=head2 B<update($id, %extra_keys)>
 
Updates the I<extra> keys of the element that matches the given C<$id>.
 
Please note that it will only update or add new keys. So if the given element
already has a key and this is not provided in C<%extra_keys> then it wont
be modified.
 
=cut
sub update {
    my ($self, $id, $properties) = @_;
 
    if (defined $self->{'stack_hash'}->{$id}) {
        foreach my $key (keys %$properties) {
            $self->{'stack_hash'}->{$id}->{$key} = $properties->{$key};
        }
    } else {
        warn "Not updating $id, does not exist!";
    }
}



( run in 0.213 second using v1.01-cache-2.11-cpan-454fe037f31 )