|P is for Practical|
Config::Std multi-part problemby carcassonne (Pilgrim)
|on Dec 12, 2005 at 16:23 UTC||Need Help??|
carcassonne has asked for the
wisdom of the Perl Monks concerning the following question:
I'd like to add a second (and possibly others) values to a section of a configuration file. This is known as a multi-part value in Config::Std documentation. The problem is, when the config file is read, there's already one such multi-part value although for the moment it's the only one.
That config file is read and test2 should be added to give the following:
Problem is, when first read, Config::Std returns 'test1' as a scalar. How is it possible to add another value to a scalar unless a modification of the data type is made (i.e. erasing directly the scalar in memory and replacing it by an array) ? Or am I missing something about Config::Std (or Perl in general ;-) that would do this without directly hacking Config::Std's way of representing data ?
...Or when there's only one value, the 'element:' tag should be dropped...
Save the first snippet above in test.cfg and use the following: