[html-formfu] refactoring defaults_from_model (DBIC)

Carl Franks fireartist at gmail.com
Mon Jan 14 10:13:12 GMT 2008


On 12/01/2008, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> Hi all,
>
> I've changed defaults_from_model. Instead of scanning the db fields of
> the given row and then matching them against form fields - I made it
> walk through the form fields and match them against the db fields.
> That let me reduce the code twice ( in line numbers and number of
> subroutines), and also the coupling between the routines (by reducing
> the number of parameters they take).  I believe the resulting code is
> much simpler - and it is also more general (works for has_many
> relations with Select boxes and probably makes less assumptions about
> the structure of the form).  All tests passed.
>
> The resulting HTML::FormFu::Model::DBIC is attached - please comment.
>
> If no one is against it I'll commit it to the svn soon.
>
> I am planning to add updating relationships to the DBIx::Class update
> method - and then base save_to_model on that.  This should be another
> big code reduction.

It looks good.
I'm currently working on some more test files - to make absolutely
sure everything's covered - so hopefully it can be committed very
soon.

Thanks,
Carl



More information about the HTML-FormFu mailing list