Dancer icon indicating copy to clipboard operation
Dancer copied to clipboard

Standalone vs. PSGI Handler and plack_middlewares

Open jwittkoski opened this issue 9 years ago • 0 comments

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?

jwittkoski avatar Mar 06 '15 21:03 jwittkoski