Um, no, I understand that. I have a database connection in that child process, and it's represented by a row in a table. When the connection is closed, I want the row to be deleted first.
The connection will close when the handle goes out of scope, but for global handles that doesn't happen at the right time. So I'd like to have an END block kicked off when the child exits (not when the request completes, that's too soon; not when the server exits, that's too late).
What I may be missing is just what happens to a child when you do a "killall -HUP httpd"; I believe the child exits and a new one takes its place. However, the END blocks are not run, apparently.
| -- |
| Jeff Boes |
| Database Engineer |
| Nexcerpt, Inc. |
|
|
|
...Nexcerpt...Connecting People With Expertise
|
| [reply] [d/l] |
Okay, so the actual problem here is that your END blocks don't seem to run when you HUP the server? Have you tried putting in warnings in the END blocks to be certain that they aren't running?
Keep in mind that when you load the package with the END block makes a difference. If you load it during startup, it is supposed to run when each child exits. If you load it from an Apache::Registry script (or if it is in that script), it is supposed to run after each request.
By the way, usually the support for this kind of question is better on the mod_perl list than on PerlMonks, since there are more people there who are familiar with the internals of the mod_perl code.
| [reply] |
Would it be possible to use only lexically scoped ('my') handles or do an explicit disconnect() at the end of your script? What I don't understand is why you would need to have database connections alive after the script ends. Are your trying to pool database connections and in that way save on the cost of connecting each time? Doesn't Apache::DBI do that already? CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] |