Moose Goodness.
Today I solved a silly problem, that was spawned by the MooseX::SimpleConfig role being so clever and fantastic.
I have a list of locations that I want to search for configuration files, and was mucking with them and then came up with this wonderful construct:
package MyDist::App;
use Moose;
use FindBin;
with 'MooseX::SimpleConfig';
with 'MooseX::Getopt';
has +configfile => (
default => ( grep { defined $_ and -f $_ } (
$ENV{APP_CONFIG},
"$FindBin::Bin/../conf/config.yml",
"$FindBin::Bin/conf/config.yml",
"$FindBin::Bin/config.yml",
) )[0] || ''
);
So, it just descends the list at runtime and picks the proper config file out and away I go. I am very happy that this works so well. It also merges in well with any command-line options.
Comments