Plack::Middleware::Conditional is a piece of meta-middleware, to run a specific middleware component under runtime conditions. The goal of this middleware is to avoid baking runtime configuration options in individual middleware components, and rather share them as another middleware component.

Note that in the last example MobileDetector should come first because the conditional check runs in pre-run conditions, which is from outer to inner: that is, from the top to the bottom in the Builder DSL code.