Mojolic...LConfig(3)
π Mojolic...LConfig(3) π
okay bestie, welcome to the Mojolic...LConfig(3) page β itβs from User Contributed Perl Documentation, and weβre about to make YAML config make sense. no cap.
β¨ NAME β¨
Mojolicious::Plugin::NotYAMLConfig β Not quite YAML configuration plugin. Itβs giving βYAML but make it Perl,β and honestly? iconic.
πΈ SYNOPSIS πΈ
Hereβs the vibe, copy-paste style, so keep it exact:
# myapp.yml (it's just YAML with embedded Perl)
---
foo: bar
baz:
- β₯
music_dir: <%= app->home->child('music') %>
# Mojolicious
my $config = $app->plugin('NotYAMLConfig');
say $config->{foo};
# Mojolicious::Lite
my $config = plugin 'NotYAMLConfig';
say $config->{foo};
# foo.html.ep
%= config->{foo}
# The configuration is available application-wide
my $config = app->config;
say $config->{foo};
# Everything can be customized with options
my $config = plugin NotYAMLConfig => {file => '/etc/myapp.conf'};
π¦ DESCRIPTION π¦
So Mojolicious::Plugin::NotYAMLConfig is a YAML configuration plugin that preprocesses its input with Mojo::Template. By default it uses CPAN::Meta::YAML for parsing β and lowkey, thatβs not the best YAML module available, but itβs good enough for most config files. If you need something more correct, you can use a different module like YAML::XS with the module option. slay.
The application object can be accessed via $app or the app function. A default configuration filename in the application home directory will be generated from the value of moniker in Mojolicious ($moniker.yml). You can extend the normal configuration file $moniker.yml with mode specific ones like $moniker.$mode.yml, which will be detected automatically. cute.
These configuration values are currently reserved:
config_overrideβ If this configuration value has been set inconfiginMojoliciouswhen this plugin is loaded, it will not do anything besides loading deployment specific plugins.pluginsβ One or more deployment specific plugins that should be loaded right after this plugin has been loaded.
For plugins, the shape is:
plugins:
- SetUserGroup:
user: sri
group: staff
The code of this plugin is a good example for learning to build new plugins, youβre welcome to fork it.
See PLUGINS in Mojolicious::Plugins for a list of plugins that are available by default.
π OPTIONS π
Mojolicious::Plugin::NotYAMLConfig inherits all options from Mojolicious::Plugin::JSONConfig and supports the following new ones.
π§ module π§
# Mojolicious::Lite
plugin NotYAMLConfig => {module => 'YAML::PP'};
Alternative YAML module to use for parsing.
π METHODS π
Mojolicious::Plugin::NotYAMLConfig inherits all methods from Mojolicious::Plugin::JSONConfig and implements the following new ones.
π§ parse π§
$plugin->parse($content, $file, $conf, $app);
Process content with render in Mojolicious::Plugin::JSONConfig and parse it with CPAN::Meta::YAML.
sub parse ($self, $content, $file, $conf, $app) {
...
$content = $self->render($content, $file, $conf, $app);
...
return $hash;
}
π register π
my $config = $plugin->register(Mojolicious->new);
my $config = $plugin->register(Mojolicious->new, {file => '/etc/foo.conf'});
Register plugin in Mojolicious application and merge configuration.
π SEE ALSO π
MojoliciousMojolicious::Guides<https://mojolicious.org>
okay thatβs the whole page, bestie π this was Mojolic...LConfig(3) from perl v5.42.0, dated 2026-07-15. periodt β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Mojolicious 9.480.0-bp160.2.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms