package MyApp;
...
my $value = $config->foo(default => "value");
...
This means that you need to include the default each place in the code where you want to query for foo.
One way to handle this is to have a default config defined in Clustericious/App.pm and YourApp.pm in YAML/Mojo::Template format, leveraging something like extends_config.
package MyApp;
...
my $value = $config->foo;
...
__DATA__
---
foo: value
The other way to do it is with a class method returning a hash.
package MyApp;
sub defaults { { foo => "value" } }
...
my $value = $config->foo;
...
the old default mechanism should work with a deprecation warning for at least a few months.
The way it works now is dumb.
This means that you need to include the
default
each place in the code where you want to query forfoo
.One way to handle this is to have a default config defined in Clustericious/App.pm and YourApp.pm in
YAML
/Mojo::Template
format, leveraging something likeextends_config
.The other way to do it is with a class method returning a hash.
the old
default
mechanism should work with a deprecation warning for at least a few months.