Bug fix: conf_get() now returns correct data by checking what type of reference the requested value is.

This commit is contained in:
Elijah Perrault committed 2011-01-18 20:37:49 -07:00
1 parent d70aa1fb6d
commit 29fdfe65b2
2 files changed
+20 -3

No files matched your search

+2
View File
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev 3.0 Indev
================================================================== ==================================================================
* Bug fix: conf_get() now returns correct data by checking
what type of reference the requested value is.
* Foundation completed. * Foundation completed.
* Added API function err() * Added API function err()
* Added API function dbug() * Added API function dbug()
+18 -3
View File
@@ -59,13 +59,28 @@ sub conf_get
# Return the requested configuration value(s). # Return the requested configuration value(s).
if ($count == 1) { if ($count == 1) {
return $Auto::SETTINGS{$val[0]}; if (ref($Auto::SETTINGS{$val[0]}) eq 'HASH') {
return %{ $Auto::SETTINGS{$val[0]} };
}
else {
return $Auto::SETTINGS{$val[0]};
}
} }
elsif ($count == 2) { elsif ($count == 2) {
return $Auto::SETTINGS{$val[0]}{$val[1]}; if (ref($Auto::SETTINGS{$val[0]}{$val[1]}) eq 'HASH') {
return %{ $Auto::SETTINGS{$val[0]}{$val[1]} };
}
else {
return $Auto::SETTINGS{$val[0]}{$val[1]};
}
} }
elsif ($count == 3) { elsif ($count == 3) {
return $Auto::SETTINGS{$val[0]}{$val[1]}{$val[2]}; if (ref($Auto::SETTINGS{$val[0]}{$val[1]}{$val[2]}) eq 'HASH') {
return %{ $Auto::SETTINGS{$val[0]}{$val[1]}{$val[2]} };
}
else {
return $Auto::SETTINGS{$val[0]}{$val[1]}{$val[2]};
}
} }
else { else {
return 0; return 0;