Terence Monteiro ha scritto:
[snip]
not happen? I am initializing the database connection in a Controller. Is
there any problem in this, though it may not be the best design. Will
putting the database initialization code in the Model help? I have included
afaict, you should let dbic / cat-model handle the connection to the
database. I usually use something like this: a
MyApp/Model/Main.pm
package which inherits from e.g.
Catalyst::Model::DBIC::Schema
and calls
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
connect_info => [ $dsn, $user, $pass, $options ],
);
This way I don't explicitly connect at startup, but let the framework
perform the actual connection when needed (i.e. at first db access, with
something like $c->model('Main')->resultset('Users')->find($id))
[snip]
HTH
--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
_______________________________________________
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/