Subject: | Bug in Config::Std |
Date: | Wed, 22 Nov 2006 15:42:42 -0000 |
To: | <bug-config-std [...] rt.cpan.org> |
From: | "Duncan Garland" <duncan.garland [...] ntlworld.com> |
Hi,
Config::Std doesn't put sections into nested hashes.
In desperation I copied the exact example from the CPAN documentation:
The configuration file:
# A simple key (just an identifier)...
simple : simple value
# A more complex key (with whitespace)...
more complex key : more complex value
# A new section...
[MULTI-WHATEVERS]
# A value spread over several lines...
multi-line : this is line 1
: this is line 2
: this is line 3
# Several values for the same key...
multi-value: this is value 1
multi-value: this is value 2
multi-value: this is value 3
When incorporated into the test script:
use Config::Std;
use Data::Dumper;
read_config( "t2.ini", %c );
print Dumper( %c ) . "\n";
Produces the output:
$VAR1 = '';
$VAR2 = {
'more complex key' => 'more complex value',
'simple' => 'simple value'
};
$VAR3 = 'MULTI-WHATEVERS';
$VAR4 = {
'multi-value' => [
'this is value 1',
'this is value 2',
'this is value 3'
],
'multi-line' => 'this is line 1
this is line 2
this is line 3'
};
That's not what it says in the documentation!
Furthermore $c{MULTI-WHATEVERS}{multi-value} is undefined.
I enjoyed reading your book on best practices, but I've spent several hours
trying to use this module!
Regards
Duncan Garland