Dancer
Dancer copied to clipboard
Standalone vs. PSGI Handler and plack_middlewares
If PLACK_ENV
is set then if app.psgi
uses this pattern to start up the Dancer layer:
sub { Dancer->dance($req) }
The Dancer::Handler::Standalone
handler is used.
But when this is used:
dance; # or start
The Dancer::Handler::PSGI
handler is used. See _start
in Dancer.pm
for details.
(Both handlers end up using HTTP::Server::PSGI
.)
When using the sub { Dancer->dance($req) }
pattern the loading of Plack middleware using the plack_middlewares config keyword is skipped, which was a surprise.
Shouldn't these two behave the same? Or was this distinction on purpose?
In _start
there is a note:
# Backward compatibility for app.psgi that has sub { Dancer->dance($req) }
Is using this sub
pattern not recommended?