INI.pm untested

filter: Statementstmt 0.0% 0 / 7 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 9 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use v5.12.0;
2 use warnings;
3 package Config::INI 0.029;
4 # ABSTRACT: simple .ini-file format
5  
6 #pod =head1 SYNOPSIS
7 #pod
8 #pod Config-INI comes with code for reading F<.ini> files:
9 #pod
10 #pod my $config_hash = Config::INI::Reader->read_file('config.ini');
11 #pod
12 #pod ...and for writing C<.ini> files:
13 #pod
14 #pod Config::INI::Writer->write_file({ somekey => 'somevalue' }, 'config.ini');
15 #pod
16 #pod See L<Config::INI::Writer> and L<Config::INI::Reader> for more examples.
17 #pod
18 #pod =head1 GRAMMAR
19 #pod
20 #pod This section describes the format parsed and produced by Config::INI::Reader
21 #pod and ::Writer. It is not an exhaustive and rigorously tested formal grammar,
22 #pod it's just a description of this particular implementation of the
23 #pod not-quite-standardized "INI" format.
24 #pod
25 #pod ini-file = { <section> | <empty-line> }
26 #pod
27 #pod empty-line = [ <space> ] <line-ending>
28 #pod
29 #pod section = <section-header> { <value-assignment> | <empty-line> }
30 #pod
31 #pod section-header = [ <space> ] "[" <section-name> "]" [ <space> ] <line-ending>
32 #pod section-name = string
33 #pod
34 #pod value-assignment = [ <space> ] <property-name> [ <space> ]
35 #pod "="
36 #pod [ <space> ] <value> [ <space> ]
37 #pod <line-ending>
38 #pod property-name = string-without-equals
39 #pod value = string
40 #pod
41 #pod comment = <space> ";" [ <string> ]
42 #pod line-ending = [ <comment> ] <EOL>
43 #pod
44 #pod space = ( <TAB> | " " ) *
45 #pod string-without-equals = string - "="
46 #pod string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ?
47 #pod
48 #pod Of special note is the fact that I<no> escaping mechanism is defined, meaning
49 #pod that there is no way to include an EOL or semicolon (for example) in a value,
50 #pod property name, or section name. If you need this, either subclass, wait for a
51 #pod subclass to be written for you, or find one of the many other INI-style parsers
52 #pod on the CPAN.
53 #pod
54 #pod The order of sections and value assignments within a section are not
55 #pod significant, except that given multiple assignments to one property name within
56 #pod a section, only the final one is used. A section name may be used more than
57 #pod once; this will have the identical meaning as having all property assignments
58 #pod in all sections of that name in sequence.
59 #pod
60 #pod =head1 DON'T FORGET
61 #pod
62 #pod The definitions above refer to the format used by the Reader and Writer classes
63 #pod bundled in the Config-INI distribution. These classes are designed for easy
64 #pod subclassing, so it should be easy to replace their behavior with whatever
65 #pod behavior your want.
66 #pod
67 #pod Patches, feature requests, and bug reports are welcome -- but I'm more
68 #pod interested in making sure you can write a subclass that does what you need, and
69 #pod less in making Config-INI do what you want directly.
70 #pod
71 #pod =head1 THANKS
72 #pod
73 #pod Thanks to Florian Ragwitz for improving the subclassability of Config-INI's
74 #pod modules, and for helping me do some of my first merging with git(7).
75 #pod
76 #pod =head1 ORIGIN
77 #pod
78 #pod Originaly derived from L<Config::Tiny>, by Adam Kennedy.
79 #pod
80 #pod =cut
81  
82 1;
83  
84 __END__