[Catalyst] catalyst tutorial: MyAppDB/Book.pm vs. MyApp/Model/Book.pm

mla maurice.aubrey at gmail.com
Tue May 15 20:56:43 GMT 2007


Matt S Trout wrote:
> On Tue, May 15, 2007 at 03:47:57AM -0700, mla wrote:
>> So with that design you'd get the centralized validation, which
>> is most critical to me, but then you could use SQL freely
>> and get back a collection of read-only active record objects
>> if you did fancy stuff.
> 
> You -can- pass a custom chunk of SQL to DBIC for the where clause and have
> it Just Handle It. The fact that most people choose not to is, however, a
> hint as to where the better engineering practice lies :)

Why is that the better practice?

You mentioned the fact that 'perl -c' can syntax check your query.
That's a good point, but OTOH, it can't check it for meaning (it's
still simple to produce the wrong results so you'll need to
test the actual, running query).

I can see it from a database-independence argument. In that case you
either abstract the SQL away or you have an easy way to override SQL
for specific engines.

Thanks,

Maurice



More information about the Catalyst mailing list