plack middlewares not loaded from config.yml
Hi dancers, I manage to load Plack middlewares from app.pl, but not from the config.yml file. *** In *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
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@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@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
That's what I ended up doing, cheers =) --- Pierre Masci I check email a couple times daily; to reach me sooner, you can send me a text message via this page: https://awayfind.com/mascip On 6 December 2013 13:27, sawyer x <xsawyerx@gmail.com> wrote:
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@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@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
participants (2)
-
Pierre M -
sawyer x