[dancer-users] plack middlewares not loaded from config.yml

sawyer x xsawyerx at gmail.com
Fri Dec 6 13:27:01 GMT 2013


Dancer2 has disabled adding Plack middlewares through the app. The proper
way to do this is to use Plack::Builder.
There are a few examples, but it's pretty straight-forward.

use Plack::Builder;
use Plack::Middleware::Debug;
use MyApp;

builder {
    enable 'Debug',
    MyApp->start,
};




On Fri, Oct 18, 2013 at 2:39 PM, Pierre M <piemas25 at gmail.com> wrote:

> Hi dancers, I manage to load Plack middlewares from app.pl, but not from
> the config.yml file.
>
>     *** In *app.pl <http://app.pl>* I have:
>
> use Plack::Builder;
> builder {
>     enable 'Debug', panels =>
>     [qw<Memory Timer>];
>
>     HabitLab->dance;
> };
>
> which works.
>
>
>     *** Here is what i put in *config.yml* instead (and which doesn't
> work) :
> layout: "main"
>
> plack_middlewares:
>  -
>   - Debug
>   - panels
>   -
>    - Memory
>    - Timer
>
> I know that the config file is used, because my layout is used.
> And I know that this YAML is valid, and produces the following structure
> (outputed with Data::Printer) :
> \ {
>     plack_middlewares   [
>         [0] [
>             [0] "Debug",
>             [1] "panels",
>             [2] [
>                 [0] "Memory",
>                 [1] "Timer",
>            ]
>         ]
>     ]
> }
>
> What I don't understand, is why the middleware doesn't work in this case.
>
> Any idea?
>
>
> I've followed the examples from here and there:
> http://advent.perldancer.org/2011/16
>
> http://search.cpan.org/dist/Dancer/lib/Dancer/Cookbook.pod#Plack_middlewares
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20131206/af684db5/attachment-0001.html>


More information about the dancer-users mailing list