[dancer-users] Before Hook hit multiple times.
Rick Bragg
rbragg at gmnet.net
Wed Jan 2 22:47:56 GMT 2013
> On Wed, Jan 2, 2013 at 5:16 PM, Rick Bragg <rbragg at gmnet.net> wrote:
>> hooks and routes are called once in the application flow. Do I really have to
>> program around this taking into consideration the number of times the before hook
>> is called on each page?
>
> HTTP is stateless. The client can make as many requests as it likes
> and your Dancer app will see them as separate requests.
>
> The 'before' hook fires for every request. If you want to limit a
> hook to particular routes, you have to write that logic yourself in
> the hook subroutine or else wrap the route handlers instead of using a
> before hook.
>
> David
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
Thanks, I know well the stateless nature of HTTP :) It does make sense that Dancer
has an in for every resource request... I'm trying to put some logic in one place
to test custom fine-grain user/groups/roles/permissions management stuff on every
page get or form post. I guess this runs on EVERY resource request so I need to
think about that. It makes sense, but it just seemed a little weird and maybe
needs some extra programming workaround.
Thanks!
Rick
More information about the dancer-users
mailing list