Mojo so far

More notes for my future reference than anything else: this is a list of things which have puzzled me because they’re not in the documentation

  • form parameter parsing on POSTs was looking for the MIME type ‘x-application-urlencoded’, not  ‘x-www-form-urlencoded’, which is what Firefox is sending. I don’t know why. I added the other MIME type to line 78 of Mojo/Message.pm; must get around to emailing the author about it
  • To get form parameters in a controller, you say $c->request->params->param($name) (for GET) or $c->request->body_parameters->param($name) for POST.
  • Passing variables to the Mojo::Template seems to be done by setting $c->stash() to a hashref (or whatever else you want) and then pulling it out in the template

That said, I am enjoying playing with this stuff. It’s not often that I actually enjoy reading other people’s source code in order to understand it.

Fiddling with Mojo

I seem to have some time to play with new things, so I’ve been tinkering with Mojo and Mojolicious. And because people who complain about lack of documentation in new software but then don’t do anything about it are unpleasant, instead of doing that, I’ll be recording what I find out here.

So far I like what I see enough to persist with having to read the source to find out how things work.

The most frustrating thing was the lack of documentation for how a controller method is supposed to get path variables (like id). I’ve found that $c->match->{stack}[0]{id} works, but that seems a bit long-winded.