Saturday, June 7, 2008

erlang parse simple config file

In erlang there is a simple way of making config files, just use file:consult/1.
It parses a file that contains erlang terms terminated by a dot.

Given this input file:


{hello, world}.
foo.
42.

It can be used like this:

file:consult("test.txt").
{ok,[{hello,world},foo,42]}


neat eh?
Post a Comment