Chris Laco wrote: > Off Topic. Making a note for myself and DBIC::Validation > > 100 can be validated because we have %colinfo {size => 100} > Patterns could be covered in validation_profiles at the source > level...but maybe this would be nice as well: > > { > type => 'VARCHAR', > size => 100, > validation => qr/[EMAIL PROTECTED]/ > #validation => sub{} > } > > > /me urns for better validaiton profiles created from DBIC %colinfo
This gets at precisely the issue I've been wrestling with lately. Validation constraints at all levels (db, model, controller, form, etc.) seem to sort themselves into two general categories: field-specific questions ("Is it required/unique?", "Does it match a given pattern?", etc.) and broader domain-level interdependencies ("Require at least one of the following...", "If A is 'foo' then B must match /^bar|baz|qux$/", etc.) This leads me to want to define those constraints in different places. For example, I'd love to be able to define per-column validation patterns/subs at the DBIC level as Chris describes above, and then utilize that meta info to validate input at higher levels (model, controller, form) as MST described in another post on this thread. But I'd also need a way to create a profile for, let's say, form field validation interdependencies (which can be independent of domain/model/db-level interdependencies, as previously noted). But how do I implement a concise way of accomplishing all these things? Or is the fact that I have so many things to worry about an indicator that this isn't going to be concise? If Chris were to implement a per-column profile option for DBIx::Class::Validation, I'd be inclined to look for a way to use Data::FormValidator at several levels. Would it make sense to have a method that would compile everything from %colinfo and validation_profile() into a single profile that could then be utilized (and modified/extended) at the model/controller level? And should this branch of the thread be moved to the DBIC list? Jason _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/