We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'll second the vote for Config::General -- I've not tried too many others, but I found it quick and easy to get working (i.e. about two minutes). It's designed to match the apache config format. Options are name/value pairs (equals optional). Also supports blocks (become hashes), named blocks (hashes within hashes), and multiple identical options (arrays), long lines separated with \, here documents, include files, and numerous options to control how these fancy configuration settings are handled (including a default hash). As I said, though, the basic operation is quick and painless. Another nice feature is that Config::General has both save_file() and save_string() methods if for some reason you'd like to get the text of the config file and handle file operations yourself (or print to command line for redirection). Stealing a page (rather, function) from Config::Auto, I use a routine to search for a config file with a bunch of standard names in a bunch of standard places so it doesn't even have to be entered on the command line or hard-coded. So the following snippet of code is just part of my standard script template now.
I thought about releasing the find_file code in a standalone module, but figured I'd see how Config::Auto matured and if it winds up included similar functionality. -xdg Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk. DG: edited code example for clarity and elegance In reply to Re: Re: Saving application configuration to files
by xdg
|
|