[Catalyst] Using model layers between Catalyst and DBIC

Tomas Doran bobtfish at bobtfish.net
Mon Jan 2 11:50:21 GMT 2012

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.


More information about the Catalyst mailing list