dgaramond2 has asked for the wisdom of the Perl Monks concerning the following question:

Up until now I usually handle application configuration with a combination of: a) YAML parser module; b) reading env vars by myself, and c) Getopt::Long. Which is boring, to say the least.

After a bit of CPAN browsing, I find App::Options fills my needs quite nicely. It provides usage text via --help automatically (a big! point). It can also merge configuration from command line, environment variables, and config files.

The only thing it doesn't seem to handle is data structures like arrays or hashes (e.g. specifying multiple --exclude's and --include's).

And it would be nice if the module doesn't invent its own file format, I prefer YAML. Or at least, the file format should be able to handle data structures too.

Is there a better-fitting Perl module for me?

  • Comment on Searching for the perfect application config module

Replies are listed 'Best First'.
Re: Searching for the perfect application config module
by madbombX (Hermit) on Nov 11, 2006 at 05:41 UTC
    There are a whole bunch of config modules on CPAN that can work to help you with a default config. I prefer (after being a sysadmin for so many years) Config::ApacheFormat. But I have also successfully used Config::General and Config::Generic. It sounds to me like Config::ApacheFormat would do the trick for you since you can create vars (or data structures) within the config file and its not reinventing the wheel (its using Apache Configuration Format). It also has the capability of doing includes (depending on what you actually mean by includes.
Re: Searching for the perfect application config module
by fmerges (Chaplain) on Nov 11, 2006 at 21:37 UTC

    Hi,

    I like YAML but there's also AppConfig which is used by a lot of people too.

    Regards,

    fmerges at irc.freenode.net