Dancer::Config::load called twice?
I was looking through the source files just out of curiosity to see how things work and I have a couple of queries. Dancer::Config->load is called twice, first when Dancer::import is called, then again in Dancer::_start. Why is it necessary to call it the second time? And what is the purpose of these lines in Dancer::Config::load? I think that for a key to be in %$SETTINGS, it's hook must already have been called (via _trigger_hooks). So forcing the hooks to be called again like this seems unnecessary to me. 171 foreach my $key (grep { $setters->{$_} } keys %$SETTINGS) { 172 $setters->{$key}->($key, $SETTINGS->{$key}); 173 } Thanks for info and I'm Sorry for poking around in the internals :) Alex
The first one load the default config file, and the second load the environment config file ? Le 25 mars 2011 à 11:15, Alex C a écrit :
I was looking through the source files just out of curiosity to see how things work and I have a couple of queries.
Dancer::Config->load is called twice, first when Dancer::import is called, then again in Dancer::_start. Why is it necessary to call it the second time?
And what is the purpose of these lines in Dancer::Config::load? I think that for a key to be in %$SETTINGS, it's hook must already have been called (via _trigger_hooks). So forcing the hooks to be called again like this seems unnecessary to me.
171 foreach my $key (grep { $setters->{$_} } keys %$SETTINGS) { 172 $setters->{$key}->($key, $SETTINGS->{$key}); 173 }
Thanks for info and I'm Sorry for poking around in the internals :)
Alex _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Both load the settings from the config and environment files and nothing changes if I comment out the second call. Maybe it's so that settings in the config files will take priority over settings set in the startup script... On 28 March 2011 07:50, Geistteufel <geistteufel@yahoo.fr> wrote:
The first one load the default config file, and the second load the environment config file ?
Le 25 mars 2011 à 11:15, Alex C a écrit :
I was looking through the source files just out of curiosity to see how things work and I have a couple of queries.
Dancer::Config->load is called twice, first when Dancer::import is called, then again in Dancer::_start. Why is it necessary to call it the second time?
And what is the purpose of these lines in Dancer::Config::load? I think that for a key to be in %$SETTINGS, it's hook must already have been called (via _trigger_hooks). So forcing the hooks to be called again like this seems unnecessary to me.
171 foreach my $key (grep { $setters->{$_} } keys %$SETTINGS) { 172 $setters->{$key}->($key, $SETTINGS->{$key}); 173 }
Thanks for info and I'm Sorry for poking around in the internals :)
Alex _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (2)
-
Alex C -
Geistteufel