I need to check incoming data in several web application controllers before saving to DB ( DBIx::Class
). Basically, I need to check the value for each column using a callback (anonymous sub). At first I thought about using Params::Validate
in every controller. But this approach has two problems:
There is no easy way to deal with Params::Validate
validation errors, as it just dies from the first invalid parameter with an error string.
I have to duplicate the validation logic for each column in all controllers that violates the DRY principle.
I think the best way is to do the logical part of model validation. What is the preferred way to do this in DBIx::Class
?
source share