[Catalyst] instantiating persistent DBHs: MyApp.pm? Model?

Matt S Trout dbix-class at trout.me.uk
Sun Jun 24 09:16:20 GMT 2007


On Sun, Jun 24, 2007 at 12:17:27AM -0600, Todd Harris wrote:
> Hi all -
> 
> I'm a newb to Catalyst and am trying to retrofit some code into the  
> framework.  In particular, I'm debating about the best place to  
> position some database handles.  Most of these have their own APIs,  
> negating the need for something like CDBI or DBIx::Class;  others are  
> for obscure oo-databases.
> 
> In the past, I've relied on persistence of globals under mod_perl to  
> establish DBHs to these resources in a tradtional Perl module  
> inheritance layout.   What might be the most appropriate for these  
> under Catalyst?  Should I look to put methods that establish DB  
> connections under MyApp.pm and stash the database handles in $c?   
> Should I subclass Catalyst::Model instead?

Catalyst::Model::DBI :)

The code in there is derived from the DBIC storage code so it's more robust
than anything you're going to write yourself (we have more people breaking
ours :)

-- 
      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/ 



More information about the Catalyst mailing list