1. The script from the Cookbook:
my $appdir=realpath( "$FindBin::Bin/..");
Dancer2::Config::setting('appdir',$appdir);
Dancer2::Config::load();
print "environment:".config->{environment}."\n";
print "log:".config->{log}."\n";
fails with:
Undefined subroutine &Dancer2::Config::setting called at script2.pl line 9.
Although I can see a setting function in Dancer2::Core::Role::ConfigReader?
2. What's the best way for my perl modules to access settings?
eg. if Main.pm says:
my $foo = myApp::FooMaker->new();
FooMaker.pm can get config settings via:
a) Using an approach similar to the above
b) Having all config or specific parts of config passed in
since FooMaker is Dancer2 unaware.
Does adding:
use Dancer2;
to FooMaker make it Dancer2 aware? (ie. give it access to all the Dancer environment?)
and if so, what kind of Dancer2 environment does one need to make for unit tests of FooMaker functions/methods?
thanks,
Nathan