[Catalyst] Models Inheriting from Catalyst::Base
Bill Moseley
moseley at hank.org
Thu Nov 17 19:59:26 CET 2005
On Thu, Nov 17, 2005 at 11:29:08AM -0600, Brandon Black wrote:
> AFAIK, the advantage of using Catalyst base classes in your model is
> that your ::Loader configuration can come from Catalyst-derived
> ->config() directives, which in turn means you can set your database
> dsn, password, etc from your application YAML config, instead of
> hardcoding it in the Model file.
But, that's not a requirement -- if you don't mind hard-coding the
name of the application.
Here's my entire model class:
package App::M::CDBI;
use DB;
DB->new( App->config->{database} );
1;
Can someone point me to docs on what happens if you inherit from
Catalyst? IIRC, Catalyst will call your new() method (which, IIRC,
should call $self->NEXT::new($c)) and then you can store your object
in $c->components hash.
I have not had the need to use $c->component (or $c->model etc.) yet,
so that's a hole in my understanding of Catalyst.
--
Bill Moseley
moseley at hank.org
More information about the Catalyst
mailing list