On 2 Jan 2012, at 01:41, Bill Moseley wrote:
So, I'm wondering how best to do that if I provide a separate model
layer that includes data validation. For example, say I have a
model for user management which includes a method for creating new
users. If I have a model method $users->add_user( \%user_data ) I
would tend to have it return the new user object or throw an
exception on failure. What probably makes sense is using exception
objects and have Catalyst catch those to render the error in an
appropriate way. Is this an approach you are using? Any other
tips on structuring the model layer that works well with both
Catalyst and non-Catalyst applications?
Yes, it is an approach I'm using - at least for api type applications.
I'm doing something very like using https://metacpan.org/module/HTTP::Throwable
, although my code doing this pre-exists that module.
Cheers
t0m
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/