in reply to [SOLVED] Default DB connection details not found: Plack::Test & Dancer2

Figured out the problem...

I had actually installed my app library into @INC as App::EnvUI, and in my test file, it was loading that one. In that path, the library was obviously not able to find a config file relative to its location.

If I hadn't of actually installed the module into the system, I would have gotten a Can't locate App/EnvUI.pm in @INC, instead, it was loading the @INC file, complaining about no DB info, as it couldn't read a config file.

The answer was to add:

use FindBin; use lib "$FindBin::Bin/../lib";

To the top of the test file, prior to use App::EnvUI;. That forced the test file to load the application library that's relative to itself, in the application dir structure, instead of the one in @INC, and of course, it knew exactly where to grab the config file from.

So, it was my fault. Because Dancer2 doesn't require a config file, it won't error out if it can't find one, which led to the confusion as to what was going on.

In the end, I figured out that no config file was loaded by putting a print Dumper $dsl; on line 514 of Dancer2::Plugin. In the test run, the config_file directive was an empty array ref, but in the normal run, it had the proper config file listed as an element in the aref. I realized at that time that it was the environment that was wrong, not any code.