[Catalyst] Where to put FormValidator profiles?

Phil Mitchell seasprocket at gmail.com
Thu Aug 11 21:53:15 CEST 2005


On 8/11/05, Bill Moseley <moseley at hank.org> wrote:
> I've been placing my Data::FormValidator profiles in my call to
> $c->form in the controller where they are being used.  It's nice that
> I see exactly what's happening within the controller, but it also
> seems like it might be better to have the profiles all defined in one
> place.

I've been wrestling with this, too, in a fairly complex app. I think
it's not particularly important to have all your profiles in one
place. What _is_ important is to find a way to define the list of
column names only once. In my app that means not repeating them in
both the profile and the CDBI def's, and not repeating them in
subclasses. The latter is tricky bc profiles don't inherit very well,
but mine do change throughout the inheritance hierarchy. Basically my
solution is to abstract the column lists to the degree necessary, in
some cases even out of the model class itself.


> 
> Is anyone defining profiles and loading them for their entire
> application?
> 
> Can I override Cat::Plugin::FormValidator's prepare() to use DFV's
> new() instead of check()?  Then I could define global defaults and
> named profiles.
> 
> Also, where's a good place to put profiles?  I suppose a file might be
> good, set in the application config.  But I'm curious how others
> organize this.
> 
> Thanks
> 
> 
> --
> Bill Moseley
> moseley at hank.org
> 
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 


-- 
==========================
2People Blog: http://2-people.blogspot.com/
2People site: http://www.2people.org



More information about the Catalyst mailing list