iinteractive/OX — pull request #10 by domm (2013-05-25 21:19:11+00:00)
Title: prepare_app called on every request

When a Middleware has a dependency (resolved via Bread::Board), this Middlewares prepare_app method will be called on every request. This feels like a bug to me.

This pull request adds a test that illustrates the problem:
t/middleware_prepare_app.t

But there is a comment in the "guilty" code:
OX::Application::Role::Sugar -> around 'to_app' lines 88ff

The comment seems to indicate that Middlewares with dependencies need to be re-evaled on each request. I don't know enough OX internals to understand the issue here, but it makes complex middlewares rather unusable (and thus OX...)
Even Plack::Middleware::Session will not cache its state/store...

When I tried to remove the around to_app code, my test works, but
t/middleware_dependencies.t
failed

Any ideas what to do?