Config:...::Reader(3)

✨ Config::MVP::Reader ✨

okay bestie so this is a section 3 man page from the User Contributed Perl Documentation set, and the star of the show is Config::MVP::Reader πŸ’– she's the one who reads your config and hands it off, no cap.


🌸 NAME 🌸

Config::MVP::Reader β€” an object that reads config from storage and feeds it into an assembler 🫢


πŸŽ€ VERSION πŸŽ€

version 2.200013 β€” yes bestie, that's the one, iykyk ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

use Config::MVP::Reader::YAML; # this doesn't really exist

my $reader   = Config::MVP::Reader::YAML->new;

my $sequence = $reader->read_config('/etc/foobar.yml');

(and yes, before you @ me: that Config::MVP::Reader::YAML doesn't really exist β€” it's just here to show you the vibe 😭)


πŸ’… DESCRIPTION πŸ’…

so here's the whole thing, bestie. A Config::MVP::Reader exists to read configuration data from storage (like, a file, obviously) and convert that data into instructions for a Config::MVP::Assembler, which then turns them into a Config::MVP::Sequence β€” the final product, the main character, the moment πŸ‘‘

like it's a whole pipeline and she's the first step, periodt.


🌈 PERL VERSION 🌈

This module should work on any version of perl that's still getting updates from the Perl 5 Porters. which means... any version of perl released in the last two to three years. so if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38 πŸ’–

and like, yeah, it may work on older versions of perl, but no guarantee is made that the minimum required version won't get bumped. the version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. so don't come for her, she said what she said πŸ’€


⭐ ATTRIBUTES ⭐

πŸ“ add_cwd_to_lib

If true (which it is by default, so yes, she's on by default bestie) then the current working directory will be locally added to @INC during config loading. this helps deal with changes made in Perl v5.26.1. iconic workaround behavior, honestly πŸ™ˆ


πŸ”₯ METHODS πŸ”₯

🧚 read_config

my $sequence = $reader->read_config($location, \%arg);

This method is passed a location, which has no set meaning, but should be the mechanism by which the Reader is told how to locate configuration. It might be a file name, a hashref of parameters, a DBH, or literally anything else, depending on the needs of the specific Reader subclass. she's flexible like that πŸ’…

It's also passed a hashref of arguments, and of those there is only one valid argument:

  • assembler β€” the Assembler object into which to read the config

If no assembler argument is passed, one will be constructed by calling the Reader's build_assembler method. she'll build her own bestie, it's fine ✨

Subclasses should generally not override read_config, but should instead implement a read_into_assembler method, described below. If a subclass does override read_config, it should take care to respect the add_cwd_to_lib attribute, above. don't skip that part, bestie, it matters 😭

πŸ’œ read_into_assembler

This method should not be called directly. It is called by read_config with the following parameters:

my $sequence = $reader->read_into_assembler( $location, $assembler );

The method should read the configuration found at $location and use it to instruct the $assembler (a Config::MVP::Assembler) what configuration to perform.

The default implementation of this method will throw an exception complaining that it should have been implemented by a subclass. so like, if you didn't do your homework, she's gonna yell 🫢


πŸ‘‘ build_assembler

If no Assembler is provided to read_config's assembler parameter, this method will be called on the Reader to construct one.

It must return a Config::MVP::Assembler object, and by default will return an entirely generic one. lowkey the most chill method here fr fr πŸ’–


🌸 AUTHOR 🌸

Ricardo Signes <cpan@semiotic.systems>


This software is copyright (c) 2022 by Ricardo Signes.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source queen πŸ’…


okay that's the whole page bestie, you ate that 🫢 and just so you have the receipts: this was perl v5.42.0, dated 2025-07-25, from Config:...::Reader(3). mwah πŸ’–βœ¨

πŸ“¦ where this page comes from