Great module; keep up the good work.
C::G has a nice, human-readable/writeable syntax, and is convenient for managing simple configuration.
However... it can become increasingly frustrating for complex scenarios. Because it returns a bare Perl data-structure, options with single values will be returned as hash-references, and options with multiple values as array-refs. This means that in the case that you don't *know* how many options you'll get back, you have to faff about with flattening list refs etc.
(Helpfully, unless you're running 5.10, whenever you get this wrong, you'll get annoying warnings about pseudo-hashes, but the error may occur somewhere random in your code, leading to more debugging fun).
You might think you know how many values to expect, but it's surprisingly easy to make mistakes on this, especially if you overlay multiple configuration files (site and local, for example). Some settings, such as -MergeDuplicateBlocks might help with this; sadly we weren't using it in our project.
Also, C::G is incapable of outputting "named blocks" (e.g. <page foo.html>). Though the documentation claims that this is functionally identical, it can only emit a much uglier <page><foo.html>.
> But there are some missing items in the
> documentation, such as "save_file".
That's wrong. There is a section about save_file() in the docs. Read at search.cpan.org/~tlinden/Config-Gener...
> Also, when saving back to a config file
> the order and formatting is rearranged.
> I know the formatting can be altered, but
> no way or documentation has been found on
> how to do so.
No. There's an option "-Tie" which can be supplied to new(). It takes a Tie class name as argument. The docs are explaining it:
"You could, for example supply a tied hash, say Tie::DxHash, which preserves ordering of the keys in the config."
So, just read the docs. Try "perldoc Config::General".
This is a very good concept and I love to use it. But there are some missing items in the documentation, such as "save_file". Also, when saving back to a config file the order and formatting is rearranged. I know the formatting can be altered, but no way or documentation has been found on how to do so.
Just trying to help. Aside from that, it's really an amazing piece of Perl. Way to go!
Easy to implement and a whole slew of features and options. The configuration files for programs using this module are in an apache style, so no more smb.conf madness. (:
Best feature i like is the ability to load a config, munge it and save it again.
An excellent module for creating "apache-like" configuration. Every program using Perl should use this for his configuration file.
3 hidden unhelpful reviews