[dancer-users] Before Hook hit multiple times.

Alexis Sukrieh sukria at sukria.net
Thu Jan 3 10:46:17 GMT 2013


>
> >> While the above explanation makes sense, and understanding it can lead
>> to
>> >> designing applications better, my gut feeling is with Rick. If I
>> create a
>> >> 'before' hook, I want it normally to fire once everything the human
>> user makes a
>> >> request even though under the scene the browser is making multiple
>> requests. In
>> >> other words, the current behavior seems to be against the DWIM nature
>> that I
>> >> would expect.
>>
>
I don't think I would agree here. Let me elaborate on my point of view:

Dancer is a DSL to write a web application. Its purpose is to provide a
clean and intuitive syntax for describing how to handle a request and which
response to produce. This is based of course on the HTTP protocol, and
Dancer relies entirely on that.

That means that everything in Dancer's point of view is related to an
incoming _request_. In the HTTP meaning. If Chrome hits favicon.ico
whenever you hit the app, you'll send 2 requests every time you hit the
browser's reload button. You are sending 2 requests, period.

Dancer sees 2 requests, and acts accordingly.

Implementing a workaround to simulate the concept of "human requests"
versus real "HTTP requests" sounds crazy to me and error-prone.

What makes Dancer so appealing is its thin layer over the HTTP stack, this
kind of change or enhancement is dangerous, I think.

I'm sorry if I'm not following you on this one, I hope you see my point of
view :)

Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130103/cc8c13eb/attachment-0001.htm>


More information about the dancer-users mailing list