A little AppConfig tip

June 20, 2014

I have a little tip for AppConfig, one apparently not everyone knows, as I discovered in a household discussion.

The wonderfully useful module AppConfig reads ini files

bar = 1
baz = 2

derp = 4

and makes them accessible in a configuration object like so:

$cfg->foo_bar; # return 1

Now, if you want parameters not in any section, put those at the top of your config file. For $cfg->hork:

hork = 1
bar = 1

If you put it lower down you’ll end up with $cfg->foo_hork or $cfg->herp_hork.

That is all. Carry on.