[Catalyst] How many models?
John Napiorkowski
jjn1056 at yahoo.com
Thu Apr 26 22:51:57 GMT 2007
----- Original Message ----
From: Jamie Neil <jamie at versado.net>
To: catalyst at lists.rawmode.org
Sent: Thursday, April 26, 2007 5:02:24 PM
Subject: Re: [Catalyst] How many models?
John Napiorkowski wrote:
> I think the consensus is that it's best to create business logic type
> models outside of Catalyst and then build a simple wrapper model for
> it. That way you can use it for stuff like cron jobs and anything
> that doesn't live inside of Catalyst.
That's exactly what we're trying to do.
> Now I isolated the business logic for creating an account into the
> MyApp::Logic::Accounts package because for my system creating a new
> user is much more than just inserting a row into the Users database.
> The logic would using the MyApp::Schema::Users Class and some other
> classes and wrap all that into a neat interface.
Again, this is the direction we are going, however what I was concerned
about was that this way we would end up with a lot more database handles
that was necessary (we may have three or four models). Whilst this is
not a problem for a single application, we are planning on running many
instances sharing the same database server.
Of course I may just be misunderstanding how DBIx::Class works :)
To be honest I'm not so sure what DBIx::Class does for this, although I haven't had any trouble with the above approach scaling when I do heavy testing. I figure that you Catalyst application would create a database handle and then if you ran a cron job that would create it's own handle for it's lifetime.
If this was a problem you could probably override the DBIC connection class to first check to see how many open handles on a database exists before trying to create a new one. I'd check the DBIC documentation (which is extensive) or mailing list archives (also extensive) and if you can't get a good answer post to the DBIx:Class mailing list.
DBIC searchable archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/
Good luck! --John
--
Jamie Neil | <jamie at versado.net> | 0870 7777 454
Versado I.T. Services Ltd. | http://versado.net/ | 0845 450 1254
_______________________________________________
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/
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Catalyst
mailing list