John M Vinopal wrote:
> For programmer ease you probally want to connect inside a module, and for
> mod_perl speed you want to preload that module. But you can't do both AND
> connect once at the start. Mod_perl insists that dbh connections must not
> be made in the parent and then used in the child: that means that you cannot
> initialize your dbh in BEGIN or outside of a subroutine.
You can preload the module without actually making the connection. When
using Apache::DBI, you do want to call DBI->connect once per request so
that your database handle will be ping'ed. You can use
Apache::DBI->connect_on_init() to make sure that there's a cached
connection waiting for you when you issue your first DBI->connect().
- Perrin