[Catalyst] About Model naming

Matt S Trout dbix-class at trout.me.uk
Thu Jun 15 19:58:59 CEST 2006


Eric W. Bates wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Another n00b question.
> 
> I have successfully created a Model utilizing DBIx::Class::Schema and a
> Controller to successfully display a resultset. However, I'm confused
> about the package naming for the Model.
> 
> Catalyst root is HG.
> 
> The DBIx::Class::Schema definitions are:
> HG/lib/HG/Schema.pm		package HG::Schema
> HG/lib/HG/Schema/Plants.pm	package HG::Schema::Plants
>    etc..
> 
> The Model is:
> HG/lib/HG/Model/HorshamDB.pm	package HG::Model::HorshamDB
> 				schema_class HG::Schema
> 
> My confusion occurs in the Controller, when I invoke the model the
> package name that works is 'HorshamDB::Plants'. I originally tried:
> HG::Model::HorshamDB
> HG::Model::HorshamDB::Plants
> HG::Schema
> HG::Schema::Plants
> 
> Perhaps in the context of $c->model() I'm not really loading a package?

$c->model prefixes w/MyApp::Model for convenience and code re-use between 
applications.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list