Wednesday, October 20, 2010

WebNano

In the weekend I published WebNano to CPAN. There is some documentation there - so it is ready for experimenting. I am thinking about a "Why WebNano" article. For now let me just say this: WebNano has just 232 lines of code in 'lib' (as reported by sloccount) and beside Plack it uses only minimal dependencies, but when porting a non-trivial blog engine from Catalyst to WebNano I did not miss any Catalyst features. To be honest in that conversion I did use two WebNano extensions (both also already published), Template Toolkit renderer with dynamic paths and a CRUD controller, but even including them the line count would not excede 500.

2 comments:

Jakub Narebski said...

How WebNano differs from other PSGI/Plack based microframeworks like Dancer or Mojolicius?

zby said...

That is a good question. For a longer answer please wait for the 'Why WebNano' article - but for now the main differences are: controller in request scope (see http://misko.hevery.com/2009/04/15/managing-object-lifetimes/ and http://misko.hevery.com/2009/04/08/how-to-do-everything-wrong-with-servlets/ for why this is important), actions are methods not anonymous functions - so they work with inheritance etc, dispatching is minimal but easily extend-able on per directory basis and is close to the code where it dispatches (you don't need to switch between two places in the code to add another dispatchable action), WebNano is (at least for now) decoupled from building the application object. It is also many times smaller than both of these frameworks.