Merge branch 'after-262'
[kivitendo-erp.git] / SL / LxOfficeConf.pm
1 package SL::LxOfficeConf;
2
3 use strict;
4
5 use Config::Std;
6 use Encode;
7
8 sub read {
9   my $file = -f 'config/lx_office.conf' ? 'config/lx_office.conf' : 'config/lx_office.conf.default';
10   read_config $file => %::lx_office_conf;
11   _decode_recursively(\%::lx_office_conf);
12 }
13
14 sub _decode_recursively {
15   my ($obj) = @_;
16
17   while (my ($key, $value) = each %{ $obj }) {
18     if (ref($value) eq 'HASH') {
19       _decode_recursively($value);
20     } else {
21       $obj->{$key} = decode('UTF-8', $value);
22     }
23   }
24 }
25
26 1;