[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Teardown cleanup


Hi,

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)?

I am not sure if this works, but you could try to flush the Perl output buffer. This will send your HTML from the CGI to Apache and Apache will probably hand it off directly to the client.
Probably...

something like this on top of teardown

local $| = 1;
print;

If it does work, this (flushing before teardown) could be something to include into the CGI::Application module itself.

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.

I think you are right.
But why don't you put your subroutines into proper Perl modules?
Not all that difficult to set up and has many benefits (such as not having to worry about what mod_perl does with it).


Thilo


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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.