1IniHash(3)            User Contributed Perl Documentation           IniHash(3)
2
3
4

NAME

6       Config::IniHash - Perl extension for reading and writing INI files
7
8       version 3.00.00
9

SYNOPSIS

11         use Config::IniHash;
12         $Config = ReadINI 'c:\some\file.ini';
13

DESCRIPTION

15       This module reads and writes INI files.
16
17   Functions
18       ReadINI
19
20               $hashreference = ReadINI ($filename, %options)
21               $hashreference = ReadINI (\$data, %options)
22               $hashreference = ReadINI (\@data, %options)
23               $hashreference = ReadINI ($filehandle, %options)
24
25       The returned hash contains a reference to a hash for each section of
26       the INI.
27
28           [section]
29           name=value
30         leads to
31           $hash->{section}->{name}  = value;
32
33       The available options are:
34
35       heredoc
36           - controls whether the module supports the heredoc syntax :
37
38                   name=<<END
39                   the
40                   many lines
41                   long value
42                   END
43                   othername=value
44
45           Default: 0 = OFF
46
47       systemvars
48           - controls whether the (system) variables enclosed in %% are
49           interpolated and optionaly contains the values in a hash ref.
50
51               name=%USERNAME%
52             leads to
53               $data->{section}->{name} = "Jenda"
54
55                   systemvars = 1  - yes, take values from %ENV
56                   systemvars = \%hash     - yes, take values from %hash
57                   systemvars = 0  - no
58
59       case
60           - controls whether the created hash is case insensitive. The
61           possible values are
62
63             sensitive     - the hash will be case sensitive
64             tolower       - the hash will be case sensitive, all keys are made lowercase
65             toupper       - the hash will be case sensitive, all keys are made uppercase
66             preserve      - the hash will be case insensitive, the case is preserved
67             lower - the hash will be case insensitive, all keys are made lowercase
68             upper - the hash will be case insensitive, all keys are made uppercase
69
70       withdefaults
71           - controls whether the created section hashes support defaults.
72
73       sectionorder
74           - if set to a true value then created hash will contain
75
76                   $config->{'__SECTIONS__'} = [ 'the', 'names', 'of', 'the', 'sections', 'in', 'the',
77                           'order', 'they', 'were', 'specified', 'in', 'the', 'INI file'];
78
79       allow_multiple
80           - if set to a true scalar value then multiple items with the same
81           names in a section do not overwrite each other, but result in an
82           array of the values.
83
84           - if set to a hash of hashes (or hash of arrays or hash of comma
85           separated item names) specifies what items in what sections will
86           end up as hashes containing the list of values. All the specified
87           items will be arrays, even if there is just a single value. To
88           affect the items in all sections use section name '*'.
89
90           By default false.
91
92       forValue
93           - allows you to install a callback that will be called for each
94           value as soon as it is read but before it is stored in the hash.
95           The function is called like this:
96
97             $value = $forValue->($name, $value, $sectionname, $INIhashref);
98
99           If the callback returns an undef, the value will not be stored.
100
101       comment
102           - regular expression used to identify comments or a string
103           containing the list of characters starting a comment.  Each line is
104           tested against the regexp is ignored if matches. If you specify a
105           string a regexp like this will be created:
106
107                   qr/^\s*[the_list]/
108
109           The default is
110
111                   qr/^\s*[#;]
112
113       You may also set the defaults for the options by modifying the
114       $Config::IniHash::optionname variables. These default settings will be
115       used if you do not specify the option in the ReadINI() or ReadSection()
116       call.
117
118       ReadSection
119
120         $hashreference = ReadSection ($string)
121
122       This function parses a string as if it was a section of an INI file and
123       creates a hash with the values.  It accepts the same options as
124       ReadINI.
125
126       WriteINI
127
128         WriteINI ($filename, $hashreference)
129
130       Writes the hash of hashes to a file.
131
132       PrintINI
133
134       The same as WriteINI().
135

AUTHOR

137       Jan Krynicky <Jenda@Krynicky.cz> http://Jenda.Krynicky.cz
138
140       Copyright (c) 2002-2005 Jan Krynicky <Jenda@Krynicky.cz>. All rights
141       reserved.
142
143       This program is free software; you can redistribute it and/or modify it
144       under the same terms as Perl itself.
145
146
147
148perl v5.12.0                      2008-02-18                        IniHash(3)
Impressum