The first time I took a look at Mojolicious was almost a year ago if I’m not mistaken. My Perl was really rusty back then and the Mojolicious’ documentation, or rather the lack of it, didn’t help much either. Still, with interest I followed the project through GitHub. Development on the project, and especially the last few months has been very active. The author, Sebastian Riedel, seems very devoted to the project and his productivity is very inspiring.
By now Mojolicious has matured a lot in my eyes. Documentation is a lot better than it was and is still being improved. To my understanding he’s nearing a feature freeze which means a proper stable 1.0 version will be out soon. This also means for me that I can start using Mojolicious without the agony of backwards incompatibility with every small update.
What I like about Mojolicious is that its pretty lightweight, has no dependencies besides core modules and is already supporting HTML5 features like Websockets. Now, I don’t know yet precisely what Websockets are good for (the Wikipedia entry isn’t very helpful either), but it shows that Mojolicious is geared toward support for modern techniques. To my understanding it allows for the browser to keep a connection open with the webapplication so you don’t need a polling system to retrieve updates. Which is something Ajax is being abused for at the moment.
Because Mojolicious doesn’t use any other modules it has its own templating system as well. It’s pretty feature complete, but I can’t coop with the syntax. Others have blogged about this as well. Templates look horrible and are unreadable. Which is a shame. A more Template-Toolkit like syntax would’ve been nicer. But that would also mean reinventing the wheel, again. Which is what Mojolicious is doing quite a bit (e.g. Mojo::JSON). Nothing wrong with that though, as on of the key points for Mojolicious is to be independent of other modules, except for core modules.
Luckily, it’s easy enough to replace the default renderer with another one. MojoX::Renderer::TT nicely wraps up Template-Toolkit. Inside the startup method of your application it’s easy enough to set it up as the default renderer.
One tiny thing I’m missing, and maybe I’ve overlooked it, is a standard way of using configuration files. I’m used to the Catalyst way of doing this, which is a breeze, but so far haven’t found a standard way to do this in Mojolicious. I suppose I can easily fix this with using Config::Any myself.
So far my hands-on with Mojolicious has been small, but it did the job for me. All I needed was a simple web application that can log usage through a REST API. Together with Test::Mojo writing tests was a breeze. I did have to go through the documentation quite a bit to figure out where and what everything was. But this is no different with any other framework you’re learning. Whilst testing I had run into a tiny problem which turned out to be my fault, not Mojolicious’. Still, Sebastian was kind enough to promptly respond to my question at IRC and was very helpful.
I didn’t use Mojolicious::Lite by the way. Whilst it would’ve worked perfectly for my use case I don’t understand yet how it’s easy to convert a Mojolicious::Lite webapplication to a normal structured Mojolicious webapplication. It would’ve made implementing the REST API easier since Mojolicious::Lite has routines for setting up PUT, POST, GET, DELETE and HEAD requests. But since the webapplication will scale to something bigger in the future I don’t want to rewrite the Lite edition to a structured version. I don’t have time for that.
Compared to my experience from a year ago it was fun to use Mojolicious this time. I’m certainly going to use it for more small and low traffic webapplications. For now I’ll stick with Catalyst for the big webapplications. But that’s because there are already a lot of extra modules for it, has excellent documentation, it’s highly configurable and I bought an expensive Catalyst book (don’t worry, I like it and ordered it through the Catalyst website so the Enlightened Perl Organisation gets a donation).