I want to do some cleanup after the HTML has been emitted. I believe the
teardown method is the place to do it. I have a few questions.

1. The browser doesn't display the page until teardown returns. If I put a
sleep(10) in teardown, the browser waits 10 seconds. I can fork a copy,
close STDIN/OUT/ERR and that fixes the problem. Is there a less expensive
way to tell Apache to close its buffer (or whatever it has to do to tell the
browser to display the page)?

2. If fork is the only way to do this, roughly how much post-serve
processing justifies incurring the expense of forking? Is fork pretty minor
and therefore it doesn't require much post-serve processing to justify doing
it? (In my case, it's two database updates, deleting some files on disk.)

3. I thought about putting "teardown" in a super class (like the examples
for prerun). But, if I fork there won't the child inherit the entire
environment ($self)? Would it be better to put the fork in a required
library, call it as a subroutine, so everything is out of scope when the
child is created? Or, is there no difference in terms of overhead? (I'm
thinking there's no difference.).

While I'm asking questions. Here's another. I have not used mod_perl but I
have read about the problems closures can cause. All the examples I've seen
refer to "my" variables in the main program which are accessed by
subroutines in the main program. My question is: if I have subroutines in a
"require"d .pl file, and I put "my ($var1, $var2, $var4)" at the top of the
.pl file (so they are lexically scoped to the required file and
visible/shared by all the subroutines in that file) will this turn into a
problematic closure when I use mod_perl? It seems to me this is different
because the required .pl file is already its own closure. It won't be
affected by the mod_perl wrapper that goes around the main process.

Thanks,
Mark


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to