MooseX:...::Config(3)

πŸŽ€ MooseX::App::Plugin::Config β€” config files for your MooseX::App apps, bestie πŸŽ€

okay so this is the MooseX::App::Plugin::Config page from the User Contributed Perl Documentation, and honestly? it's giving "let your app read a config file and slay." let's get into it πŸ’…


✨ SYNOPSIS ✨

first up, in your base class:

package MyApp;
use MooseX::App qw(Config);

option 'global_option' => (
    is          => 'rw',
    isa         => 'Int',
);

then over in your command class:

package MyApp::Some_Command;
use MooseX::App::Command;
extends qw(MyApp);

option 'some_option' => (
    is          => 'rw',
    isa         => 'Str',
);

now bestie, go make a config file (peep Config::Any for the deets) β€” a yaml file for example, like this:

---
global:
  global_option: 123
some_command:
  global_option: 234
  some_option: "hello world"

and now the user can literally just call the program with a config file, no cap:

bash$ myapp some_command --config /path/to/config.yml

ate. periodt. 🫢


🌸 METHODS 🌸

  • config β€” reads the config filename, that's her whole job πŸ’–
  • _config_data β€” the full content of the loaded config file, every last crumb πŸ“

πŸ’œ SEE ALSO πŸ’œ

  • Config::Any β€” go look, iykyk ✨

that's the whole vibe, bestie. this page is perl v5.42.0, dated 2024-08-09, and it's the MooseX:...::Config(3) manual page β€” screaming, crying, throwing up, but make it config files πŸ¦‹πŸ‘‘πŸ’€

πŸ“¦ where this page comes from