Im going through my code, and trying to really think about how i can make it 
work well. Its a mess, i am realising, and i need advice on the best way
to clean it up.

Its clear that there are things in my Model that should be in a Controller; 
that i dont need help with.

My problem is that i have two different Models, and dont know how they should 
be combined.

In particular, im using DBIC, so i have a setup where i have 
MyApp::Schema::Main, which only looks like:

package MyApp::Schema::Main;
use base qw/DBIx::Class::Schema/;

__PACKAGE__->load_classes(qw/Book Author/);

1;

(the config stuff is in a separate config file:)

<Model::MyAppDB>
        schema_class MyApp::Schema::Main
        connect_info #######
</Model::MyAppDB>

Then i'll have MyApp::Schema::Main::Book of whatever that looks like

package MyApp::Schema::Main::Book;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/PK::Auto Core/);
(etc., other DBIC stuff)

The problem is i also have a MyApp::Model::Book, and ive usually put non-DBIC 
things in there, like if i have a "get_results" method thats
specific to my Cat app and not appropriate for the schema, ill put it there. 
That starts like

package MyApp::Model::Book;
use strict;
use warnings;
use base 'Catalyst::Model';

So ive got these two model classes, one i call with $c->model('MyAppDB::Book') 
and the other with $c->model('Book'). The problem
is, i have some things that are Cat specific and i dont want them in my schema 
class (becaues i use this in non-Cat apps), but i dont want to 
have to have two separate models that i call by different names at
different times.

Whats the way im supposed to be setting these up?

Thanks!

Jen



      

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to