Skip to content

require_environment causes failure if environment is already loaded #961

Closed
sapphirecat opened this Issue Sep 16, 2013 · 4 comments

2 participants

@sapphirecat

In Dancer::Config the logic reads like:

if (environment file exists and is not loaded) { load it; }
elsif (require_environment is set) { fail; }

I am launching my app with plackup -s Starman -E development -l 127.0.0.1:9002 bin/app.pl and it appears that load gets called twice for some reason. The second time through, the environment has been loaded, so the first branch is false and the second is taken.

The error message then points to a perfectly fine and loadable YAML file, which can be rather confusing.

$Dancer::VERSION is 1.3118, and I installed it from CPAN last week via cpanm. Other major components in use are Plack 1.0029 and Starman 0.4008.

@yanick
yanick commented Sep 19, 2013

Could you provide a small example showing that problem? I've created an app using 'dancer -a foo', set 'require_environment' to be true in the config.yml, and started the whole thing via plackup, and it's all happy for me...

@sapphirecat

Please try this: sapphirecat/dancer961

I think I've hacked it down to perfection...

@yanick
yanick commented Sep 19, 2013

...

This is the best bug example evar. You're awesome.

@yanick yanick added a commit that closed this issue Sep 19, 2013
@yanick yanick fix logic for require_environment
Fixes #961
0548ca0
@yanick yanick closed this in 0548ca0 Sep 19, 2013
@yanick
yanick commented Sep 19, 2013

Bug found and eradicated. It'll be part of the next release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.