[Catalyst] FormHandler -- pro or con?
zzbbyy at gmail.com
Wed Dec 15 10:05:03 GMT 2010
On Wed, Dec 15, 2010 at 7:49 AM, Toby Corkindale <toby at dryft.net> wrote:
> On 13 December 2010 21:07, Octavian Rasnita <orasnita at gmail.com> wrote:
>> From: "Toby Corkindale" <toby at dryft.net>
>> True, but FormFu can also use Config::General code which is much clearer (or other config formats accepted by Config::Any).
>> It would be OK if H::FH would allow creating custom elements and validators, filters... using Moose, but only generic elements, not related with any form, and then allow us to use configuration files for using those elements and constraints. It is not nice at all to need writing Perl code using Moose for just creating an HTML form, but each one with his preferences. :-)
> But you can do that if you want..
> If you're just doing simple stuff, like name-of-field + type-of-field,
> then you could do something like this:
> my $form = HTML::FormHandler->new(
> item => $c->model('DB::User')->find($id),
> field_list => YAML::Load("form.yaml")
There is MooseX::SimpleConfig that is used by Catalyst itself and fits
here very well. With some Moose coercions this is enough to build any
Moose object and it let's you use any config file format that is
supported by Config::Any.
If only the underlying MooseX::ConfigFromFile was more actively maintained.
More information about the Catalyst