throughnothing/Test-WWW-Mechanize-Dancer — pull request #1 by grantm (2012-08-31 03:05:23+00:00)
Title: explicitly set envdir on startup

I found that this patch fixed the problem that my test.yml config file was not being loaded.

It turns out that the appdir setting inside of Dancer gets set twice - once when Dancer is first loaded and later it is explicitly set by Test::WWW::Mechanize::Dancer. The first time it is set, Dancer calculates a path based on the location of Test/WWW/Mechanize/Dancer.pm so for me it ended up as /home/grant/perl5/lib/perl5/Test/WWW/Mechanize - which is not very useful. Some short time later, it was overwritten with the much more sensible default of the current working directory.

The problem with all of that is that Dancer was using the appdir setting to initialise envdir and this was happening after appdir was set to the initial useless value and before it was set to the current working directory.

Which is all a long way of saying that I added the envdir option not because I wanted to use a non-default value, but because I wanted the envdir setting to be updated after appdir was changed.