1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# -*- perl -*-
use lib 't';
use strict;
use Test;
use TestConfig;
plan(tests => 7);
my %keywords = (
core => {
section => {
'retain-interval' => { mandatory => 1 },
'tempdir' => 1,
'verbose' => 1,
}
},
backend => {
section => {
file => 1
}
}
);
my $cfg = new TestConfig(parameters => \%keywords);
ok($cfg->isset('backend','foo','file'));
ok($cfg->isvariable('backend','foo','file'));
ok($cfg->get('backend','foo','file'), 'foo');
ok($cfg->isset('core', 'verbose') == 0);
ok($cfg->issection('backend','foo'));
$cfg->set('core','verbose','On');
ok($cfg->get('core','verbose'),'On');
$cfg->unset('core','tmpdir');
ok($cfg->isset('core','tmpdir') == 0);
__DATA__
# This is a sample configuration file
[core]
retain-interval = 10
tempdir = /tmp
[backend foo]
file = foo
|