On Thu, Jan 6, 2011 at 9:39 PM, Simon Wistow <si...@thegestalt.org> wrote: > On Thu, Jan 06, 2011 at 07:04:13PM +0000, me said: >> Before I write my own (or repurpose one of the hundred previosu ones >> I've written) does anyone have any recommendations? > > Thanks, Dancer looks perfect. > > Is there a good rule of thumb with these things as to whether something > should go in the middleware or not. My instinct would be: anything that > requires application logic or config (like knowing how to connect to the > datastore) should be in the app whereas stuff like, say, gzipping should > be in the middleware with any blurry lines (OAuth support for example) > handled using callbacks.
You can use App config in middlewares if you apply them in the application code (right before returning the callback). In Nblog I for serving the static files from location that is in the application config I use Plack::App::File (and combine it with my own application using Plack::App::URLMap) - in principle I could use any middleware in the same way. Is that too convoluted? -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ http://perlalchemy.blogspot.com/