1Config::Extend::MySQL(3U)ser Contributed Perl DocumentatiCoonnfig::Extend::MySQL(3)
2
3
4

NAME

6       Config::Extend::MySQL - Extend your favourite .INI parser module to
7       read MySQL configuration file
8

VERSION

10       Version 0.05
11

SYNOPSIS

13           use Config::Extend::MySQL;
14
15           # read MySQL config using Config::IniFiles
16           my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::IniFiles" });
17
18           # read MySQL config using Config::Tiny
19           my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::Tiny" });
20
21           # use the resulting object as you usually do
22           ...
23

DESCRIPTION

25       This module extends other "Config::" modules so they can read MySQL
26       configuration files. It works by slurping and preprocessing the files
27       before letting your favourite "Config::" module parse the result.
28
29       Currently supported modules are "Config::IniFiles",
30       "Config::INI::Reader" and "Config::Tiny".
31
32   Rationale
33       This module was written out of a need of reading MySQL configuration
34       files from random machines. At first, the author thought they were just
35       classical ".INI" files, but soon discovered that they include
36       additional features like "!include" and "!includedir", and bare boolean
37       options, which without surprise make most common modules choke or die.
38
39       Hence this module which simply slurps all the files, recursing though
40       the "!include" and "!includedir" directives, inlining their content in
41       memory, and transforms the bare boolean options into explicitly
42       assigned options.
43
44       As to why this module extends other modules instead of being on its
45       own, it's because the author was too lazy to think of yet another API
46       and preferred to use the modules he already know. And given he use
47       several of them, depending on the context, it was just as easy to avoid
48       being too thighly coupled to a particular module.
49

METHODS

51   new()
52       Create and return an object
53
54       Usage
55
56           my $config = Config::Extend::MySQL->new({ from => $file, using => $module });
57
58       Options
59
60       •   "from" - the path to the main MySQL configuration file
61
62       •   "using" - the module name to use as backend for parsing the
63           configuration file
64
65       Examples
66
67           # read MySQL config using Config::IniFiles
68           my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::IniFiles" });
69           # $config ISA Config::Extend::MySQL, ISA Config::IniFiles
70
71           # read MySQL config using Config::Tiny
72           my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::Tiny" });
73           # $config ISA Config::Extend::MySQL, ISA Config::Tiny
74

DIAGNOSTICS

76       "Arguments must be given as a hash reference"
77           (E) As the message says, the arguments must be given to the
78           function or method as a hash reference.
79
80       "Backend module failed to parse '%s'"
81           (F) The backend module was unable to parse the given file.  See
82           "CAVEATS" for some hints.
83
84       "Can't load module %s: %s"
85           (F) The backend module could not be loaded.
86
87       "Can't read in-memory buffer: %s"
88           (F) This should not happen.
89
90       "Empty argument '%s'"
91           (E) The given argument was empty, but a value is required.
92
93       "File '%s' is empty"
94           (W) The file is empty.
95
96       "Missing required argument '%s'"
97           (E) You forgot to supply a mandatory argument.
98
99       "No such file '%s'""
100           (F) The given path does not point to an existing file.
101

CAVEATS

103       The different supported modules don't parse ".INI" files exactly the
104       same ways, and have different behaviours:
105
106       •   "Config::IniFiles" doesn't want to create an object from an empty
107           file.
108
109       •   "Config::INI::Reader" by default doesn't allow the pound sign ("#")
110           for beginning comments.
111
112       •   when assigning the same option twice, "Config::Tiny" replaces the
113           old value with the new one, "Config::IniFiles" appends it with a
114           newline.
115
116       And probably many more.
117
118       Also note that in order to keep the code simple, this module wants Perl
119       5.6 or newer. However, a patch to make it work on Perl 5.5.3 is
120       included in the distribution (patches/patch-for-perl5.5.diff).
121

SEE ALSO

123       Config::IniFiles
124
125       Config::INI::Reader
126
127       Config::Tiny
128

AUTHOR

130       Sébastien Aperghis-Tramoni, "<sebastien at aperghis.net>"
131

BUGS

133       Please report any bugs or feature requests to "bug-config-extend-mysql
134       at rt.cpan.org", or through the web interface at
135       <http://rt.cpan.org/Dist/Display.html?Queue=Config-Extend-MySQL>.  I
136       will be notified, and then you'll automatically be notified of progress
137       on your bug as I make changes.
138

SUPPORT

140       You can find documentation for this module with the perldoc command.
141
142           perldoc Config::Extend::MySQL
143
144       You can also look for information at:
145
146       •   RT: CPAN's request tracker
147
148           <http://rt.cpan.org/Dist/Display.html?Queue=Config-Extend-MySQL>
149
150       •   AnnoCPAN: Annotated CPAN documentation
151
152           <http://annocpan.org/dist/Config-Extend-MySQL>
153
154       •   CPAN Ratings
155
156           <http://cpanratings.perl.org/d/Config-Extend-MySQL>
157
158       •   Search CPAN
159
160           <http://search.cpan.org/dist/Config-Extend-MySQL>
161
163       Copyright 2008 Sébastien Aperghis-Tramoni, all rights reserved.
164
165       This program is free software; you can redistribute it and/or modify it
166       under the same terms as Perl itself.
167
168
169
170perl v5.36.0                      2023-01-20          Config::Extend::MySQL(3)
Impressum