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.
--
Zbigniew Lukasiak
http://perlalchemy.blogspot.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DBIC.pm
Type: application/x-perl
Size: 25830 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20080112/57074cca/DBIC-0001.bin