1Config::INI(3) User Contributed Perl Documentation Config::INI(3)
2
3
4
6 Config::INI - simple .ini-file format
7
9 version 0.027
10
12 Config-INI comes with code for reading .ini files:
13
14 my $config_hash = Config::INI::Reader->read_file('config.ini');
15
16 ...and for writing ".ini" files:
17
18 Config::INI::Writer->write_file({ somekey => 'somevalue' }, 'config.ini');
19
20 See Config::INI::Writer and Config::INI::Reader for more examples.
21
23 This module has a long-term perl support period. That means it will
24 not require a version of perl released fewer than five years ago.
25
26 Although it may work on older versions of perl, no guarantee is made
27 that the minimum required version will not be increased. The version
28 may be increased for any reason, and there is no promise that patches
29 will be accepted to lower the minimum required perl.
30
32 This section describes the format parsed and produced by
33 Config::INI::Reader and ::Writer. It is not an exhaustive and
34 rigorously tested formal grammar, it's just a description of this
35 particular implementation of the not-quite-standardized "INI" format.
36
37 ini-file = { <section> | <empty-line> }
38
39 empty-line = [ <space> ] <line-ending>
40
41 section = <section-header> { <value-assignment> | <empty-line> }
42
43 section-header = [ <space> ] "[" <section-name> "]" [ <space> ] <line-ending>
44 section-name = string
45
46 value-assignment = [ <space> ] <property-name> [ <space> ]
47 "="
48 [ <space> ] <value> [ <space> ]
49 <line-ending>
50 property-name = string-without-equals
51 value = string
52
53 comment = <space> ";" [ <string> ]
54 line-ending = [ <comment> ] <EOL>
55
56 space = ( <TAB> | " " ) *
57 string-without-equals = string - "="
58 string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ?
59
60 Of special note is the fact that no escaping mechanism is defined,
61 meaning that there is no way to include an EOL or semicolon (for
62 example) in a value, property name, or section name. If you need this,
63 either subclass, wait for a subclass to be written for you, or find one
64 of the many other INI-style parsers on the CPAN.
65
66 The order of sections and value assignments within a section are not
67 significant, except that given multiple assignments to one property
68 name within a section, only the final one is used. A section name may
69 be used more than once; this will have the identical meaning as having
70 all property assignments in all sections of that name in sequence.
71
73 The definitions above refer to the format used by the Reader and Writer
74 classes bundled in the Config-INI distribution. These classes are
75 designed for easy subclassing, so it should be easy to replace their
76 behavior with whatever behavior your want.
77
78 Patches, feature requests, and bug reports are welcome -- but I'm more
79 interested in making sure you can write a subclass that does what you
80 need, and less in making Config-INI do what you want directly.
81
83 Thanks to Florian Ragwitz for improving the subclassability of Config-
84 INI's modules, and for helping me do some of my first merging with
85 git(7).
86
88 Originaly derived from Config::Tiny, by Adam Kennedy.
89
91 Ricardo Signes <rjbs@semiotic.systems>
92
94 • castaway <castaway@desert-island.me.uk>
95
96 • David Steinbrunner <dsteinbrunner@pobox.com>
97
98 • Florian Ragwitz <rafl@debian.org>
99
100 • George Hartzell <hartzell@alerce.com>
101
102 • Graham Knop <haarg@haarg.org>
103
104 • Ricardo SIGNES <com.github@rjbs.manxome.org>
105
106 • Smylers <Smylers@stripey.com>
107
109 This software is copyright (c) 2007 by Ricardo Signes.
110
111 This is free software; you can redistribute it and/or modify it under
112 the same terms as the Perl 5 programming language system itself.
113
114
115
116perl v5.34.0 2022-01-21 Config::INI(3)