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

+18 -3
View File
@@ -59,13 +59,28 @@ sub conf_get
# Return the requested configuration value(s).
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) {
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) {
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 {
return 0;