[Catalyst] C::M::{CDBI,DBIC} vs direct Loader use?
Brandon Black
blblack at gmail.com
Wed Nov 16 06:21:45 CET 2005
Assuming one is using "Loader" -type of methods to load the database
schema, as opposed to manual definitions, what exactly is the tradeoff
supposed to be between defining your base database model
("MyApp::M::MyDB") either via Catalyst::Model::CDBI/DBIC (the way
"script/myapp_create.pl model ..." does), versus defining it directly
in terms of Class::DBI::Loader or DBIx::Class::Loader without
inheriting from any Catalyst:: classes?
As near as I can tell so far (and I'm still pretty new at this whole
thing), the only difference is that the Catalyst:: route uses the
Catalyst "->config" construct, so your model config parameters could
presumably automagically come from your application-wide YAML config
file or what-have-you. Otherwise the approaches seem identical in
their net results once you get past minor syntactical differences at
class initialization time. I originally figured that deriving via
Catalyst::... must give some access to the $c context within the
database classes, but that doesn't seem to be the case (the only way
I've found to get that is via Catalyst::Plugin::Singleton).
Am I missing something here, or does that about sum it up? And would
using Singleton context access from within a method of a table within
a model be considered bad form? (This is back on that problem of
getting automatic timestamp column inflation/deflation to pay
attention to timezone settings for the current application
user/session).
Any insight appreciated :)
-- Brandon
More information about the Catalyst
mailing list