Config...::MySQL(3pm)

πŸ“¦
version 0.05 Β· 2 versions
, in fedora 43

🌸 Config::Extend::MySQL β€” the perl module page, but make it a vibe 🌸

okay bestie, so this is from the User Contributed Perl Documentation section of the manual. It's Config...::MySQL(3pm) if you're out here typing man commands, and it's literally the glow-up your .INI parser has been begging for. Let's get into it πŸ’–


✨ NAME ✨

Config::Extend::MySQL β€” extend your favourite .INI parser module to read MySQL configuration files. yes, THAT is the whole assignment. slay.


πŸŽ€ VERSION πŸŽ€

Version 0.05. small number, big energy.


🌈 SYNOPSIS 🌈

okay so here's the whole move, look:

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
...

that last ... is doing main character energy fr β€” it's you, living your life, using the object however you normally would πŸ’…


πŸ’– DESCRIPTION πŸ’–

So this module extends other Config:: modules so they can actually read MySQL configuration files. The way it works? It slurps and preprocesses the files before handing the result off to your fave Config:: module to parse. lowkey genius, no cap.

Right now the supported modules are Config::IniFiles, Config::INI::Reader and Config::Tiny. three icons, one crown πŸ‘‘

πŸ¦‹ Rationale πŸ¦‹

ngl this module was born out of pure necessity β€” the author needed to read MySQL configuration files off of random machines. At first they were like "oh these are just classic .INI files, easy", and then they found out that these files include extra features like !include and !includedir, plus bare boolean options, which β€” surprise surprise β€” make most common modules choke or straight up die πŸ’€

So that's the whole reason this module exists: it slurps all the files, recursing through the !include and !includedir directives, inlining their content in memory, and transforms the bare boolean options into explicitly assigned options. periodt.

And as for why it extends other modules instead of standing on its own two feet? 😭 the author was too lazy to think up yet another API and preferred using the modules he already knows. And since he uses several of them depending on the context, it was just as easy to avoid being too tightly coupled to any particular one. honestly? relatable. we respect the laziness πŸ™ˆ


✨ METHODS ✨

🌸 new() 🌸

Create and return an object. it's giving constructor, it's giving birth to a whole new object, iconic.

Usage

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

Options

  • from β€” the path to the main MySQL configuration file πŸ—‚οΈ
  • using β€” the module name to use as backend for parsing the configuration file πŸ”§

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

look at that inheritance chain bestie, it's giving family tree, it's giving lineage 🌳✨


🚨 DIAGNOSTICS 🚨

here's where it gets real. the letters mean stuff: (E) = error, (F) = fatal, (W) = warning. pay attention, this is the vibe check πŸ‘€

  • "Arguments must be given as a hash reference" β€” (E) literally what it says. the arguments have to be handed to the function or method as a hash reference. no hash ref, no service πŸ’…
  • "Backend module failed to parse '%s'" β€” (F) the backend module couldn't parse the file you gave it. peep the CAVEATS section for some hints if you're stuck 🫢
  • "Can't load module %s: %s" β€” (F) the backend module could not be loaded. it's just not loading, bestie.
  • "Can't read in-memory buffer: %s" β€” (F) this should not happen. (which is code for: if you see this, something has gone deeply, deeply wrong 😭)
  • "Empty argument '%s'" β€” (E) you gave an argument that was empty, but a value was required. a value!! was!! required!!
  • "File '%s' is empty" β€” (W) the file is empty. that's it. that's the warning. go put something in it πŸ“
  • "Missing required argument '%s'" β€” (E) you forgot to supply a mandatory argument. we've all been there, but still.
  • "No such file '%s'"" β€” (F) the path you gave doesn't point to an existing file. (yes, the original has that extra quote at the end β€” we keep it exactly as it is, that's just how it's written πŸ’€)

πŸ’€ CAVEATS πŸ’€

okay so real talk β€” the different supported modules do NOT parse .INI files exactly the same way, and they each have their own little behaviours:

  • Config::IniFiles doesn't want to create an object from an empty file. it simply refuses. boundaries, honestly πŸ‘‘
  • Config::INI::Reader by default doesn't allow the pound sign (#) for beginning comments. no # comments on its watch.
  • when assigning the same option twice, Config::Tiny replaces the old value with the new one, while Config::IniFiles appends it with a newline. different strokes fr fr.

And probably many more. there's always more πŸ™ˆ

Also note: 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 at patches/patch-for-perl5.5.diff. a whole patch, for the ancient ones, we love to see it 🫢


🌈 SEE ALSO 🌈

  • Config::IniFiles
  • Config::INI::Reader
  • Config::Tiny

the whole squad, together πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

SΓ©bastien Aperghis-Tramoni, "<sebastien at aperghis.net>"


πŸ› BUGS πŸ›

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/Dist/Display.html?Queue=Config-Extend-MySQL>. He will be notified, and then you'll automatically be notified of progress on your bug as he makes changes. so it's a whole notification chain, everybody stays in the loop πŸ””


🫢 SUPPORT 🫢

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/Dist/Display.html?Queue=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>

four whole places to find the info, we are COVERED ✨


Copyright 2008 SΓ©bastien Aperghis-Tramoni, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. free software, free as a butterfly πŸ¦‹


and that's the whole page bestie!! πŸ’– this one came from the User Contributed Perl Documentation section, documented for perl v5.42.0, dated 2025-07-25 β€” go forth and read those MySQL configs, you absolute icon πŸ‘‘βœ¨πŸŽ€

πŸ“¦ where this page comes from