X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/2c1c6a9a9204afad82c8e403f3fce1d0d4b9cd90..67b21d425476471298e0b2e3f5dcacc025ebaaaf:/SL/LxOfficeConf.pm diff --git a/SL/LxOfficeConf.pm b/SL/LxOfficeConf.pm new file mode 100644 index 000000000..b0d801024 --- /dev/null +++ b/SL/LxOfficeConf.pm @@ -0,0 +1,26 @@ +package SL::LxOfficeConf; + +use strict; + +use Config::Std; +use Encode; + +sub read { + my $file = -f 'config/lx_office.conf' ? 'config/lx_office.conf' : 'config/lx_office.conf.default'; + read_config $file => %::lx_office_conf; + _decode_recursively(\%::lx_office_conf); +} + +sub _decode_recursively { + my ($obj) = @_; + + while (my ($key, $value) = each %{ $obj }) { + if (ref($value) eq 'HASH') { + _decode_recursively($value); + } else { + $obj->{$key} = decode('UTF-8', $value); + } + } +} + +1;