#! /usr/bin/perl
use
5;
use
lib
"$FindBin::Bin/lib"
;
my
$c
= new Config::Nested(
section
=> [
qw( location animal)
],
boolean
=> [
qw( happy hungry alive)
],
variable
=> [
qw( sex name colour owner)
],
array
=>
'breed exercise'
,
);
$/=
undef
;
my
$conf
= <DATA>;
$c
->parse(
"alive !hungry"
) ||
die
"Parsing defaults failed\n"
;
$c
->parse(
"owner 'Peter the Great' happy"
) ||
die
"Parsing defaults failed\n"
;
$c
->parse(
"sex = male"
) ||
die
"Parsing defaults failed\n"
;
$c
->parse(
"animal Fred"
) ||
die
"Parsing defaults failed\n"
;
$c
->parse(
$conf
) ||
die
"Parsing failed\n"
;
for
my
$s
(
$c
->sections())
{
print
"================= $s ====================\n"
;
my
@obj
=
$c
->section(
$s
);
print
Dumper(\
@obj
);
}
exit
;