We're using Catalyst to render lots of webforms in what will become a large application. I don't like the way all the form data is confusingly into a big hash in the Controller, before being passed to the template. It seems jumbled up and messy for the template. I'm sure there are real disadvantages that I haven't described properly... Are there?

One solution is to just decide on a convention for the hash, e.g.:

  defaults => {
    type => ['a', 'b', 'c']
  input => {
    type => 'a'
  output => {
    message => "2 widgets found of type a",
    widgets => [ 'foo', 'bar' ]

Another way is to store the page/form data as attributes in a class (a ViewModel?), and pass a whole object to the template, which it could use like this:

<p class="message">[% model.message %]<p>

[% FOREACH widget IN model.widgets %]

Which way is more flexible for large applications?

Are there any other solutions or existing Catalyst-compatible frameworks?

1 Answer 1


HTML::FormHandler can render forms for you, using either the Simple or Table built in renderers. But you're not forced to use them. You can write your own, or leave them all out together (which is what I did, though I doubt that was a good decision). I've found it to be a very flexible module (it being built with Moose). You can also let it handle saving the data to the database with HTML::FormHandler::TraitFor::Model::DBIC, or roll your own.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.