Test2:...figData(3pm)

πŸ“¦
version 0.20 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Test2::Tools::Command::ConfigData β€” the config vault for Test2::Tools::Command, no cap

okay so real quick before we dive in: this is the manual page for Test2:...figData(3pm), filed under User Contributed Perl Documentation. yeah the name got chopped off by the terminal, it's giving ✨truncated✨, we're all used to it, moving on 🫢


✨ SYNOPSIS ✨

use Test2::Tools::Command::ConfigData;
$value = Test2::Tools::Command::ConfigData->config('foo');
$value = Test2::Tools::Command::ConfigData->feature('bar');

@names = Test2::Tools::Command::ConfigData->config_names;
@names = Test2::Tools::Command::ConfigData->feature_names;

Test2::Tools::Command::ConfigData->set_config(foo => $new_value);
Test2::Tools::Command::ConfigData->set_feature(bar => $new_value);
Test2::Tools::Command::ConfigData->write;  # Save changes

look at that, so clean, so readable, we love to see it 🌸


🌈 DESCRIPTION 🌈

bestie, listen. This module is where all the configuration data for the Test2::Tools::Command module lives. That's it, that's the whole job, and it does it iconically πŸ’…

It also hands you a programmatic interface so you can get or set that configuration data yourself. Very main character of it.

⚠️ BUT. And this is the big one. To actually make changes, you have to have write access to the Test2::Tools::Command::ConfigData module. And also?? You should attempt to understand the repercussions of your actions. Attempt. Understand. The repercussions. πŸ‘€

like, don't just go editing stuff and then be shocked pikachu when things break, okay? 😭


πŸŽ€ METHODS πŸŽ€

πŸ“ config($name)

You hand it a string argument, it hands you back the value of the configuration item with that name. And if no such item exists? You get undef. That's it. Simple. Slay.

πŸ“ feature($name)

Same energy, different shelf: you pass a string argument, you get back the value of the feature by that name. No such feature? undef for you, bestie 🫢

πŸ“ set_config($name, $value)

Sets the configuration item with the given name to the given value.

Now the tea β˜• on what a value can be: it may be any Perl scalar that will serialize correctly using Data::Dumper. That includes references, objects (usually), and complex data structures. It probably does not include transient things like filehandles or sockets β€” those are not the vibe, they don't serialize, don't try it πŸ™ˆ

πŸ“ set_feature($name, $value)

Sets the feature with the given name to the given boolean value. And the module is so thoughtful because the value gets converted to 0 or 1 automatically. You don't gotta do a thing, it just knows. ✨

πŸ“ config_names()

Returns a list of all the names of config items currently defined in Test2::Tools::Command::ConfigData.

In scalar context? It gives you the number of items instead. Two moods, one method, obsessed.

πŸ“ feature_names()

Returns a list of all the names of features currently defined in Test2::Tools::Command::ConfigData.

And yeah, in scalar context it returns the number of features. Consistency is a love language πŸ’œ

πŸ“ auto_feature_names()

Returns a list of all the names of features whose availability is dynamically determined. In scalar context? The number of such features.

Heads up though: this does not include such features that have later been set to a fixed value. Once you pin a feature down, it's out of this list, periodt. πŸ’…

πŸ“ write()

The moment of commitment. This commits any changes from set_config() and set_feature() to disk. πŸ’ΎπŸ”₯

Requires write access to the Test2::Tools::Command::ConfigData module. No write access, no write. It's in the name, iykyk.


πŸ‘‘ AUTHOR πŸ‘‘

Test2::Tools::Command::ConfigData was automatically created using Module::Build. πŸ€–

Module::Build was written by Ken Williams</>, but he holds no authorship claim or copyright claim to the contents of Test2::Tools::Command::ConfigData. So like, credit where it's due but also not where it's not. Respect the boundary bestie 🫢


okay that's the whole page!! you made it to the end, so proud of you πŸ₯ΉπŸŒΈ

this was brought to you by perl v5.36.0, dated 2023-01-15, living under the name Test2:...figData(3pm) because terminals love to truncate. bye bestie, go write some config πŸ’–βœ¨πŸŽ€