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.

On Fri, Sep 12, 2014 at 11:21 AM, Kovács Dávid [ Davs ] <[email protected]>
wrote:

> One thing I've noticed is that in Dancer2 the before hooks are executed
> even on static files; that way
> https://metacpan.org/pod/distribution/Dancer/lib/Dancer/Cookbook.pod#Sessions-and-logging-in
> is not working at all, because if the user is not logged in, the static
> (css, js etc) files are not served. Back at the time that was one of the
> reasons I went with Dancer1 instead of Dancer2.
>
> On Fri, Sep 12, 2014 at 11:00 AM, VinceW <[email protected]> wrote:
>
>>  It was also mentioned in the discussion about the roadmap for D2
>>
>> Best,
>> VinceW
>>
>> On 09/12/2014 10:59 AM, Alexis Sukrieh wrote:
>>
>> 2014-09-12 10:39 GMT+02:00 Gabor Szabo <[email protected]> 
>> <[email protected]>:
>>
>>
>>  On Fri, Sep 12, 2014 at 11:18 AM, Sawyer X <[email protected]> 
>> <[email protected]> wrote:
>>
>>
>>  It depends on the features you want, and how much you're willing to put
>> up with. :)
>>
>> Dancer2 is still not fully stable. Things are changing. However, it has
>> some spiffier features and allows some things which weren't possible in D1.
>>
>>
>>
>>  Is there a comparison table between D1 and D2 ?
>>
>>
>>  ​That would be something very good to provide, indeed.
>>
>>
>>
>>
>>
>> _______________________________________________
>> dancer-users mailing 
>> [email protected]http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>>
>>
>> _______________________________________________
>> dancer-users mailing list
>> [email protected]
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>>
>
> _______________________________________________
> dancer-users mailing list
> [email protected]
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to