The decision if you'll get a single value or an array is determined by the data. One value => string, more values => list.
If the parser gives you the result as a data structure, you will get a string or an array reference.
So when using the config data structure, you have to check whether you got a reference or a string before using the value. This is tedious.
What would be really helpful is to have a possibility to declare (inside the config file) a key as always having a list of values.
]]>Usually, Each section in a Config::MVP based INI file has a corresponding Perl Package, and each Perl Package can define an 'mvp_multivalue_args' method, which returns a list of parameters that are expected to be arrays.
Thus, regardless if a user specifies one or more, if its an array, the consuming code gets an array.
And if a user specifies a property that is not supported in array form, the user gets told they've done something wrong.
]]>In IOD you can also use this syntax:
[section]
fruits = ["apple","orange","avocado"]
But does this not simply re-expose the problem tinita was complaining about?
It forces the consuming code to determine on a case-by-case basis whether it supports an array, and subsequently requires a lot of boiler plate code to automatically switch between single, and multiple values.
]]>[section] foo=1 bar=2 bar=3
"bar" is an array, but is "foo" a simple string, or is it an array with just one element? The INI parser will probably treat it as a simple string. If the application wants "foo" to be an array, it needs to include code to "promote" a string into a one-element array.
With IOD, there is at least a way when writing the config file to unambiguously say "this is an array, even if it's only got one element at the moment".
]]>One other tool you can use is Cava Packager with any distribution you use on Windows/MacOSX/Linux, however it may or not work with recent Perl versions.
]]>