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


Config-Extend-MySQL documentation  | view source Contained in the Config-Extend-MySQL distribution.

Index


NAME

Top

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

VERSION

Top

Version 0.04

SYNOPSIS

Top

    use Config::Extend::MySQL;

    # read MySQL config using Config::IniFiles
    my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::IniFiles" });

    # read MySQL config using Config::Tiny
    my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::Tiny" });

    # use the resulting object as you usually do
    ...




DESCRIPTION

Top

This module extends other Config:: modules so they can read MySQL configuration files. It works by slurping and preprocessing the files before letting your favourite Config:: module parse the result.

Currently supported modules are Config::IniFiles, Config::INI::Reader and Config::Tiny.

Rationale

This module was written out of a need of reading MySQL configuration files from random machines. At first, the author thought they were just classical .INI files, but soon discovered that they include additional features like !include and !includedir, and bare boolean options, which without surprise make most common modules choke or die.

Hence this module which simply slurps all the files, recursing though the !include and !includedir directives, inlining their content in memory, and transforms the bare boolean options into explicitly assigned options.

As to why this module extends other modules instead of being on its own, it's because the author was too lazy to think of yet another API and preferred to use the modules he already know. And given he use several of them, depending on the context, it was just as easy to avoid being too thighly coupled to a particular module.

METHODS

Top

new()

Create and return an object

Usage

    my $config = Config::Extend::MySQL->new({ from => $file, using => $module });

Options

Examples

    # read MySQL config using Config::IniFiles
    my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::IniFiles" });
    # $config ISA Config::Extend::MySQL, ISA Config::IniFiles

    # read MySQL config using Config::Tiny
    my $config = Config::Extend::MySQL->new({ from => $file, using => "Config::Tiny" });
    # $config ISA Config::Extend::MySQL, ISA Config::Tiny

DIAGNOSTICS

Top

Arguments must be given as a hash reference

(E) As the message says, the arguments must be given to the function or method as a hash reference.

Backend module failed to parse '%s'

(F) The backend module was unable to parse the given file. See "CAVEATS" for some hints.

Can't load module %s: %s

(F) The backend module could not be loaded.

Can't read in-memory buffer: %s

(F) This should not happen.

Empty argument '%s'

(E) The given argument was empty, but a value is required.

File '%s' is empty

(W) The file is empty.

Missing required argument '%s'

(E) You forgot to supply a mandatory argument.

No such file '%s'"

(F) The given path does not point to an existing file.

CAVEATS

Top

The different supported modules don't parse .INI files exactly the same ways, and have different behaviours:

And probably many more.

Also note that in order to keep the code simple, this module wants Perl 5.6 or newer. However, a patch to make it work on Perl 5.5.3 is included in the distribution (patches/patch-for-perl5.5.diff).

SEE ALSO

Top

Config::IniFiles

Config::INI::Reader

Config::Tiny

AUTHOR

Top

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

BUGS

Top

Please report any bugs or feature requests to bug-config-extend-mysql at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Config-Extend-MySQL. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Config::Extend::MySQL




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-Extend-MySQL

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Config-Extend-MySQL

* CPAN Ratings

http://cpanratings.perl.org/d/Config-Extend-MySQL

* Search CPAN

http://search.cpan.org/dist/Config-Extend-MySQL

COPYRIGHT & LICENSE

Top


Config-Extend-MySQL documentation  | view source Contained in the Config-Extend-MySQL distribution.