1 |
package loadConfig; |
2 |
|
3 |
use strict; |
4 |
use warnings; |
5 |
|
6 |
use AppConfig qw(:expand :argcount); |
7 |
|
8 |
require Exporter; |
9 |
our @ISA = qw(Exporter); |
10 |
our @EXPORT = qw( $config ); |
11 |
|
12 |
# ================================== |
13 |
# setup configuration |
14 |
# ================================== |
15 |
|
16 |
our $config; |
17 |
|
18 |
sub raiseAppConfigError { |
19 |
my $error = shift; |
20 |
print "error while accessing configuration-data: ", $error, "\n"; |
21 |
} |
22 |
|
23 |
my $cfgfile_name = '../etc/syncOutlookContacts.ini'; |
24 |
$config = AppConfig->new({ |
25 |
CASE => 1, |
26 |
ERROR => \&raiseAppConfigError, |
27 |
GLOBAL => { |
28 |
#DEFAULT => "<unset>", |
29 |
DEFAULT => "", |
30 |
ARGCOUNT => ARGCOUNT_ONE, |
31 |
}, |
32 |
CREATE => 1, |
33 |
}); |
34 |
#$config->define("debug_level", { ARGCOUNT => ARGCOUNT_ONE } ); |
35 |
$config->define("mapi_ProfilePass", { ARGCOUNT => ARGCOUNT_NONE, DEFAULT => "" } ); |
36 |
$config->define("sync_map", { ARGCOUNT => ARGCOUNT_LIST } ); |
37 |
$config->define("sync_mapping", { ARGCOUNT => ARGCOUNT_HASH } ); |
38 |
|
39 |
$config->define("folders_use", { ARGCOUNT => ARGCOUNT_LIST } ); |
40 |
$config->define("folders_map", { ARGCOUNT => ARGCOUNT_HASH } ); |
41 |
|
42 |
if (! -e $cfgfile_name) { |
43 |
print "config-file \"$cfgfile_name\"does not exist.", "\n"; |
44 |
exit; |
45 |
} |
46 |
$config->file($cfgfile_name); |
47 |
|
48 |
# ================================== |
49 |
|
50 |
1; |