* Matt S Trout <[EMAIL PROTECTED]> [2008-02-10 08:50]:
> T::P::DBI should probably be able to take a subref that
> provides a dbh and use it on-demand. Or even one that provides
> an sth ...

I already patched that in, in preparation of having the DBH
managed by something that handles reconnects et al.

Guess I need to also patch it to defer the `prepare_cached` call.

> To reduce coupling I'd probably do (in MyAPP)
> 
> __PACKAGE__->config(
>   'View::TT' => { template_db_model => 'Foo' }
> );
> 
> and then have the view use thatas the arg to $c->model during new.

That still couples the view to a specific type of model though:
how to get the DBH out of a DBIC::Schema model is different from
how to do it with a DBI model, and with the approach you propose,
that logic lives in the view class.

I guess the right thing here would be even straighter:

    __PACKAGE__->config(
        'View::TT' => { DBI_DBH => sub { __PACKAGE__->model('Foo')->dbh } }
    );

If I understand the mechanics of `config` correctly, that will
pass straight through to T::P::DBI.

Hmm. Will try and see if it pans out.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
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