[Dancer-users] Dancer::Config Hooks - Need advice before creating PR

ambs ambs+dancer at perl-hackers.net
Tue Apr 26 23:15:23 CEST 2011


is there any rewrite taking place on Dancer::Config?

if not, I think a change is needed on hooks, but has it changes a 
relative amount of lines, I prefer to discuss it before.

at the moment we have hooks for setting names. Given a name, we find out 
what hook to run.

but we might have different settings needing the same hook to be run 
(charset needs to restart Template engine, for example, that is also run 
when the setting "template" is run).

also, I think it is possible for some settings to have more than one 
hook that should be run (no example atm).

my change proposal:
  1. create an hash that maps attribute names to a list of hook names;
  2. use the current hash of hooks, but not consider it maps settings 
into hooks, but hook names into hooks.
  3. 'set' will create a list of all hooks that need to be run for all 
settings that are been changed (as we now can change more than one at once)
  4. the hooks are all run

I know this creates an indirection level, but it seems more clear and 
versatile for the future.

/me waits to devels to agree :)


More information about the Dancer-users mailing list