Software ↑    Documentation Download References Samples Contributiors PhpVersion ConfigGeneralValidate

Config::General version 2.52

This perl module opens a config file and parses it's contents for you. It provides variable interpolation, saving of configs (kinda serializer), an OOP-Interface and much more.

The format of config files supported by Config::General is inspired by the well known apache config format, in fact, this module is 100% compatible to apache configs(read-only), but you can also just use simple name/value pairs in your config files.

In addition to the capabilities of an apache config file it supports some enhancements such as here-documents, C-style comments or multiline options.

sample configuration:

 /*
  * c-style comment
  */

 # variable assignment
 option1 = blah
 option2   blubber
 option3 = "something special"
 option4 = parameters can be written on \
           multiple lines

 # duplicate options will be made into an array
 huc = 12
 huc = 17
 huc = 133

 # options can be organized in blocks too
 <sql>
    <db>
        user   = hans
 server = mc200
 db     = maxis
 passwd = D3rf$
    </db>
    <tablestructure>
       index   int(100000)   # a comment
       name    char(100)     # another comment
       prename char(100)
       status  int(10)
     </tablestructure>
 </sql>

 # here-docs are fully supported
 usage <<EOF
   use with care
   and don't ask me
 EOF

 # use of variables
 var1 = hoho
 msg  = $var1