Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Re: Re: Don't understand END blocks in mod_perl

by Mur (Pilgrim)
on Sep 26, 2003 at 14:20 UTC ( [id://294432]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Don't understand END blocks in mod_perl
in thread Don't understand END blocks in mod_perl

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.
vox 269.226.9550 ext 24
fax 269.349.9076
 http://www.nexcerpt.com
...Nexcerpt...Connecting People With Expertise

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Don't understand END blocks in mod_perl
by perrin (Chancellor) on Sep 26, 2003 at 15:37 UTC
    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.

Re: Re: Re: Re: Re: Don't understand END blocks in mod_perl
by CountZero (Bishop) on Sep 26, 2003 at 21:51 UTC

    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://294432]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-18 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found