[html-formfu] Re: constraints_from_dbic

Carl Franks fireartist at gmail.com
Fri Mar 13 10:09:47 GMT 2009


2009/3/13 Ian Wells <ijw at cack.org.uk>:
> 2009/3/10 Ian Wells <ijw at cack.org.uk>:
>> I thought the HTML::FormFu::ObjectUtil::constraints_from_dbic method
>> might be a good idea to reduce the number of times I have to state the
>> length of character fields (an old favourite for inconsistencies).
>> But it appears to be suffering from bitrot - specifically,
>>
>>    if ( $type =~ /(char|text|binary)\z/ && defined $info->{size} ) {
>>
>> doesn't match the type of varchars coming from DBIx::Class, which is
>> {data_type => "character varying"}.
>
> OK, the data_type name came out of the DBIX::Class schema dumper, run
> on a Postgres database.  (The schema it produced wasn't portable.)
> I've fixed the schema to use more portable data types (varchar,
> specifically), which should stop the above problem happening.

Ok, though it's probably reasonable for us to support "character varying".
I would agree that constraints_from_dbic() has suffered from bitrot.

It probably should be moved into HTML::FormFu::Model::DBIC.

Ideally, I'd like to factor out the FORM <=> DBIC logic from both
update() and default_values()
into a more reusable form that can be shared between them and
constraints_from_dbic(),
so it will gain support for relationships.

It's not a trivial job though, and I've never had time to tackle it.

Carl



More information about the HTML-FormFu mailing list