> Hi, > > a) I am looking for a module to handle config files. There are a number of > these modules, like AppCconig. Any consensus about The Right Module for > this? >
Whichever module gets the job done the way you want it. I have used AppConfig with some success but it fails to handle overly complex structures (not its claim to fame either) some people (read: myself) have come to expect in a config file so I switched to using XML::Simple for more complex tasks. Since I started out in the web world that transition was obviously easy for me. I have found in general the module that is chosen is based more on the format of the config file, which is usually left up to the person editing it and how comfortable they are with doing so, or whether there will be an interface to editing it. If the config file changes a lot and non-developers will edit it go with something simple like AppConfig because it is relatively powerful without complex layout restrictions, if the config file changes in frequently, is updated by knowledgeable users, and/or has an interface for making updates then go with a module that is easily written back out and allows for arbitrarily complex data structures.... > > b) As I develop one one machine and test/deploy on another, I want > constructs in my config file like: > > if (`hostname` eq 'dev_box') { > mysql_dsn = 'foobar'; > } elsif ((`hostname` eq 'test_box'} > mysql_dsn = 'abracadabra'; > ... > > Any support for that in your module of choice? > > I know of the use-just-perl-code approach (with 'do') in the Perl Cookbook, > but I am wondering if new insights exist. > Not that I know of, that is a rather complex deal, where is hostname? is it in the path? what about machines that may not supply it? If you want a dev/q-a/prod set of config files i have found it more appropriate to use the same structure in a set of 3 different config files, then migrate the unique config files to each of the environments. Granted when you change the structure you have to update 3 copies, but it simplifies the programming, which *should* be the expensive part. Just my $.02, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]