There are many reasons to avoid configuration in code, and I go through some of them in the configuration chapter in Mastering Perl.
- No configuration change should carry the risk of breaking the program. It certainly shouldn't carry the risk of breaking the compilation stage.
- People shouldn't have to edit the source to get a different configuration.
- People should be able to share the same application without using a common group of settings, instead re-installing the application just to change the configuration.
- People should be allowed to create several different configurations and run them in batches without having to edit the source.
- You should be able to test your application under different settings without changing the code.
- People shouldn't have to learn how to program to be able to use your tool.
- You should only loosely tie your configuration data structures to the source of the information to make later architectural changes easier.
- You really want an interface instead of direct access at the application level.
I sum this up in my Mastering Perl class by telling people that the first rule of programming is to create a situation where you do less work and people leave you alone. When you put configuration in code, you spend more time dealing with installation issues and responding to breakages. Unless you like that sort of thing, give people a way to change the settings without causing you more work.