1Config::INI(3) User Contributed Perl Documentation Config::INI(3)
2
3
4
6 Config::INI - simple .ini-file format
7
9 version 0.025
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 section describes the format parsed and produced by
24 Config::INI::Reader and ::Writer. It is not an exhaustive and
25 rigorously tested formal grammar, it's just a description of this
26 particular implementation of the not-quite-standardized "INI" format.
27
28 ini-file = { <section> | <empty-line> }
29
30 empty-line = [ <space> ] <line-ending>
31
32 section = <section-header> { <value-assignment> | <empty-line> }
33
34 section-header = [ <space> ] "[" <section-name> "]" [ <space> ] <line-ending>
35 section-name = string
36
37 value-assignment = [ <space> ] <property-name> [ <space> ]
38 "="
39 [ <space> ] <value> [ <space> ]
40 <line-ending>
41 property-name = string-without-equals
42 value = string
43
44 comment = <space> ";" [ <string> ]
45 line-ending = [ <comment> ] <EOL>
46
47 space = ( <TAB> | " " ) *
48 string-without-equals = string - "="
49 string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ?
50
51 Of special note is the fact that no escaping mechanism is defined,
52 meaning that there is no way to include an EOL or semicolon (for
53 example) in a value, property name, or section name. If you need this,
54 either subclass, wait for a subclass to be written for you, or find one
55 of the many other INI-style parsers on the CPAN.
56
57 The order of sections and value assignments within a section are not
58 significant, except that given multiple assignments to one property
59 name within a section, only the final one is used. A section name may
60 be used more than once; this will have the identical meaning as having
61 all property assignments in all sections of that name in sequence.
62
64 The definitions above refer to the format used by the Reader and Writer
65 classes bundled in the Config-INI distribution. These classes are
66 designed for easy subclassing, so it should be easy to replace their
67 behavior with whatever behavior your want.
68
69 Patches, feature requests, and bug reports are welcome -- but I'm more
70 interested in making sure you can write a subclass that does what you
71 need, and less in making Config-INI do what you want directly.
72
74 Thanks to Florian Ragwitz for improving the subclassability of Config-
75 INI's modules, and for helping me do some of my first merging with
76 git(7).
77
79 Originaly derived from Config::Tiny, by Adam Kennedy.
80
82 Ricardo Signes <rjbs@cpan.org>
83
85 This software is copyright (c) 2007 by Ricardo Signes.
86
87 This is free software; you can redistribute it and/or modify it under
88 the same terms as the Perl 5 programming language system itself.
89
90
91
92perl v5.30.1 2020-01-29 Config::INI(3)