[dancer-users] Dancer 1 or Dancer 2?

Sawyer X xsawyerx at gmail.com
Fri Sep 12 14:56:36 BST 2014


On Fri, Sep 12, 2014 at 3:21 PM, Stefan Hornburg (Racke) <racke at linuxia.de>
wrote:

> On 09/12/2014 02:35 PM, Sawyer X wrote:
> > Unfortunately that is a terrible example. The concept of blocking all
> requests in a before() hook is... let's say, naive. In reality you would
> like to simply block specific requests according to session, a la David
> Golden's Auth::Tiny.
> >
> > The before hooks are basically run on every request. Static files are
> now served through the File handler. That means it will trigger the before
> hooks because it's a normal request.
> > I would love to do it using the Static middleware, but then it will
> happen before a route check on it, so we can't have that.
>
> I still disagree with this change of behaviour from Dancer 1 to Dancer 2.
> What is the benefit of calling before hook for public files?
> Also in a production environment you might deliver static files with some
> other software (Nginx, ...) and you loose control on
> these public files anyway.
>


The point is that this is not a selection of behavior. It isn't "we want a
before hook on public files", but "because public files are serves as a
handler, they will have before hooks called too". It's implicit behavior
because of the restructuring of public files as file handlers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20140912/96eaf8b0/attachment-0001.html>


More information about the dancer-users mailing list