On 2004-09-23, Cees Hek <[EMAIL PROTECTED]> wrote: > > Tony Fraser wrote: >> The names work fine for me. They are the same as Apache 2.0 uses, minus >> the leading HOOK_. Apache 1.3 didn't have that ability you had to fiddle >> with the AddModule directive order to get modules in the right order, it >> was a pain. I admit Apache is written in C and this is Perl, but still. > > That is exactly where I got the inspiration for this patch. I > especially like it, beacuse the mod_perl group has already tried > alternatives and moved to this model through experiences with other > systems of registering hooks. It ends up being very flexible, and in my > opinion simple as well. > >> In Apache REALLY_FIRST and REALLY_LAST are sort of reserved for special >> cases; you wouldn't normally use them. That leaves you with FIRST, >> MIDDLE, LAST where MIDDLE == DONTCARE. > > Exactly! The patch automatically registers hooks in the MIDDLE section > if the user doesn't provide one, so at the simplest case there should be > no confusion. > > The order is only important in rare cases, for example: A database > connection needs to be closed at the teardown stage, but maybe the > session object needs to be flushed at the teardown stage as well... in > this case, the order can be important if the session uses the database, > so the database would register a hook at the teardown stage as LAST or > even REALLY_LAST since it is a special case. I'd be happy enough to > drop the REALLY_LAST and REALLY_FIRST sections to simplify things, since > I think it would work fine with only 3 options (FIRST, MIDDLE, LAST), or > (FIRST, DONTCARE, LAST).
For reference, I looked up some the Apache documentation about this. Here's one page I found: http://httpd.apache.org/docs-2.0/developer/hooks.html I noticed that in general the "really_first" and "really_last" positions weren't highlighted. I think I would like to drop them, at least initially. MIDDLE is always described as the "don't care" option, thus I think is better named DONTCARE. (I realize I'm just re-stating what Cees has stated are reasonablie ideas above). I think my comfort level is rising with this patch. I would still love some more feedback from anyone else. Here are some other details to hatch out: - As an advanced feature, I think it could be reasonable to set apart it's documentation from the other more commonly used methods. Perhaps it would be appropriate for the new section on "writing plug-ins"? - There's something I don't understand in the patch, which looks like a bug to me: # clean up operations - $self->teardown(); + #$self->teardown(); + $self->call_hooks('teardown'); This seems to indicate that "teardown()" is no longer called at all, which didn't make sense to me. Also, would it make more sense to call the "FIRST" hooks just before teardown() runs, and the LAST hooks right afterwards? (and DONTCARE at either end...because who cares, right?) - Would it be true that "call_hooks" could be considered a private method? It seems like something a normal users would never use, and it would simply the docs a bit to exclude it there. Still, I would like to leave this patch out of the 3.30 release for now, so that can get out the door. However, this features would be worth a release on it's own, and there's not reason it has to be the multi-month process it has been for the past release. Mark -- http://mark.stosberg.com/ --------------------------------------------------------------------- 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]
