> Hi, while testing the PerlCleanupHandler in HTML::Mason: > > <%init> > $r->push_handlers(PerlCleanupHandler => \&sleeptest); > > sub sleeptest { > my $r = shift; > $r->warn("BEFORE SLEEP"); > sleep(10); > $r->warn("AFTER SLEEP"); > }; > </%init> > > I've noticed that the page only finishes loading after the > PerlCleanupHandler has completely executed. A per the > documentation the cleanup is code is supposed to happen after > the client is gone, not while he's waiting.
I became curious and tested this by registering a PerlCleanupHandler directly in apache. Documentation is correct - content was served before the cleanup handler. I know Mason quite well but I can't find any explanation for what you are seeing... I know they try to delay sending content until the last possible moment to ensure that any and all headers make it in. But I don't see how they'd make it past the content phase. Mason has an excellent mailing list, btw - somewhere on masonhq.com. May be somebody can make sense of it there! Good luck.