[Catalyst] Re: Sharing a database handle between components
Aristotle Pagaltzis
pagaltzis at gmx.de
Sat Feb 9 18:19:40 GMT 2008
* Matt S Trout <dbix-class at trout.me.uk> [2008-02-09 19:15]:
> On Sat, Feb 09, 2008 at 06:39:27PM +0100, Aristotle Pagaltzis wrote:
> > So now I have a `add_dbi_provider` method in MyApp::View::TT,
> > and then in MyApp.pm I do
> >
> > __PACKAGE__->setup;
> > __PACKAGE__->view('TT')->add_dbi_provider( __PACKAGE__->model('MyApp')->dbh );
> >
> > This seems hackish too, but at least it’s far better, I
> > think, than the hack I had before.
>
> What was wrong with just making the dbh acquired from -
>
> Scalar::Defer::lazy { $app->model('Foo')->schema->storage->dbh }
>
> ?
No idea? I never tried that?
I assume this goes in `new`?
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Catalyst
mailing list