3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Do not override pre-existing registry with default values

This commit is contained in:
Pragmatic Software 2016-01-29 13:08:40 -08:00
parent 0d70d85506
commit b4e8302f32

View File

@ -74,6 +74,10 @@ sub add {
$section = lc $section;
$item = lc $item;
if ($is_default) {
return if exists $self->{registry}->hash->{$section} and exists $self->{registry}->hash->{$section}->{$item};
}
$self->{registry}->hash->{$section}->{$item}->{value} = $value;
$self->{registry}->hash->{$section}->{$item}->{type} = $type;
@ -108,6 +112,12 @@ sub set {
$item = lc $item;
$key = lc $key if defined $key;
if ($is_default) {
return if exists $self->{registry}->hash->{$section}
and exists $self->{registry}->hash->{$section}->{$item}
and exists $self->{registry}->hash->{$section}->{$item}->{$key};
}
my $oldvalue = $self->get_value($section, $item, 1) if defined $value;
$oldvalue = '' if not defined $oldvalue;