[Catalyst] strange namespace behavior for dbic : schema

Guy Debord situationist at gmail.com
Thu Jun 7 21:40:00 GMT 2007

Matt et al,

All of my models -- such as TMP::Model::Foo -- created by the helper
-- use DBIC::Schema as a base class and are configured to use
TMP::Schema as their schema_class.

Each model that I created through the helper ends up creating classes
in the namespace, one for each table in my database prefixed by that
model's name.

So for example, here are some classes

TMP::Model::Foo::Table1 .. Table100
Same for Bar, and everything else.

TMP::Model::Foo, Bar etc exist individually as instances.

IN terms of accessing the recordsets, $c->model("Foo::Foo") and
$c->model("Bar::Foo") return the same object.

$c->model("Foo") doesn't return anything.

To create the models, I first used:

tmp_create.pl model Bar DBIC::Schema TMP::Schema create=static connect_info

and then subsequent models Foo, etc, I created leaving off create=static.

any pointers would be appreciarted.

On 6/7/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Thu, Jun 07, 2007 at 11:35:00AM -0500, Guy Debord wrote:
> > Using the helpers, I created a Model Bar
> >
> > tmp_server lists all of its classes and instances like such...
> >
> > | TMP::Model::Bar                                          | instance |
> > | TMP::Model::Bar::Bar                              | class    |
> > | TMP::Model::Bar::HeHe                             | class    |
> > | TMP::Model::Bar::HaHa                              | class    |
> >
> > This continues for every table in the schema. Each has a prefix of Bar.
> >
> > if I create another model using the helper, called Foo, with the same
> > schema object, it repeats. Every table in the schema, prefixed with
> > Foo.
> You only need one DBIC::Schema model per DBIx::Class::Schema class - try
> calling it Model::DB or something and then just use ->model('DB::Foo'),
> ->model('DB::Bar') etc.
> --
>       Matt S Trout       Need help with your Catalyst or DBIx::Class project?
>    Technical Director    Want a managed development or deployment platform?
>  Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
> http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

More information about the Catalyst mailing list