joost

personal web page

7 June 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?\

tags: lang:en - misc