mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 20:21:01 +01:00
2.29
- applied patch by brian@kronos.com via rt.cpan.org #11211. - applied patch by plasmaball@pchome.com.tw via rt.cpan.org #5846 - added new files to MANIFEST file. - added example.cfg to show the config format. git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@55 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
74
example.cfg
Normal file
74
example.cfg
Normal file
@@ -0,0 +1,74 @@
|
||||
# -*-sh-*- (ignore, this is just for my operation system, emacs,
|
||||
# to function properly)
|
||||
#
|
||||
# This is an example of a config file supported by Config::General.
|
||||
# It shows almost all features of the format and its flexibility.
|
||||
#
|
||||
# To try it, install Config::General as usual and execute the
|
||||
# following perlscript:
|
||||
#
|
||||
# use Config::General;
|
||||
# use Data::Dumper;
|
||||
# my %conf = ParseConfig(-ConfigFile => "example.cfg", -InterPolateVars => 1);
|
||||
# print Dumper(\%C);'
|
||||
#
|
||||
# This will parse the config and print out a stringified version
|
||||
# of the hash it produces, which can be used in your program.
|
||||
#
|
||||
|
||||
|
||||
/*
|
||||
* c-style comment
|
||||
*/
|
||||
|
||||
# variable assignment
|
||||
option1 = blah
|
||||
option2 blubber
|
||||
option3 = "something special" # this is a comment
|
||||
|
||||
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>
|
||||
user = hans
|
||||
server = mc200
|
||||
db = maxis
|
||||
passwd = D3rf8d
|
||||
|
||||
# nested blocks are no problem
|
||||
<tablestructure>
|
||||
index int(100000)
|
||||
name char(100)
|
||||
prename char(100)
|
||||
status int(10)
|
||||
</tablestructure>
|
||||
</sql>
|
||||
|
||||
# named blocks can also be used
|
||||
<area santa-barbara>
|
||||
# block names containing whitespaces must be quoted
|
||||
<"kyla cole">
|
||||
# blocks maybe empty
|
||||
</"kyla cole">
|
||||
</area>
|
||||
|
||||
# here-docs are fully supported
|
||||
usage <<EOF
|
||||
use with care
|
||||
and don't ask me
|
||||
EOF
|
||||
|
||||
# use of variable interpolation
|
||||
var1 = hoho
|
||||
msg = $var1
|
||||
|
||||
|
||||
|
||||
|
||||
# that's it for today.
|
||||
Reference in New Issue
Block a user