Good morning
I've recently been upgrading and rewriting a mod_perl Translation Handler. It's doing nothing too sophisticated, mainly just using a MySQL database to look up details based on an SSL certificate presented by the client.
So, one of the first things I do is to change the old function handler to being an object handler, and to abstract the storage of the client details, and write some nice tests. I ended up with something like this:
# in a startup.pl use Apache::DBI; my %args = ( 'dsn' => 'dbi:mysql:foo', 'user' => 'xx', 'pass' => 'xx'); # note this does a DBI->connect my $dbsource = MyProject::DBSource::MySQL->new(%dbargs); $My::TransHandler = MyProject::Handler->new('source' => dbsource); # in conf PerlTransHandler $My::TransHandler->handle
However, though it worked fine on my dev box, bad stuff started to happen when it went live on production. All was good for a while after restart, then more and more requests would start crawling. Looking at perrin's comment in this thread, it seems I've done a naughty thing in doing a DBI connect in startup.pl. The enlightenment I seek is why I shouldn't do this, and whether this seems a likely explanation for the problems I was seeing when the code went live.
I'll be cheeky, and ask a supplementary question: any tips for integration testing this sort of thing?
With thanks
ViceRaid
In reply to Objects, Object Handlers and mod_perl by ViceRaid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |