Mark Stosberg wrote:
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).

Sounds good to me. The MIDDLE or DONTCARE are really the default, so they could be eliminated as well. ie specify FIRST or LAST, or leave blank for the default.


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

Fair enough. It is not a critical feature for everyday CGI::App use. It is more for people writing plugins and super classes...


- 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.

This is not actually a bug. If you look at the top of the patch you will see the following line:


# Setup the default callbacks
$self->register_hook($_ => $_) foreach VALID_HOOKS;

What this is doing is registering the default hooks. VALID_HOOKS contains (cgiapp_init cgiapp_prerun cgiapp_postrun teardown), so in effect we are registering the function 'cgiapp_init' in the 'cgiapp_init' hook. So when call_hooks is called for the 'cgiapp_init' phase, the standard 'cgiapp_init' method is also called.

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

That ends up happening by default, since the standard hook methods are registered in the default section (which happens to be the MIDDLE or DONTCARE section).


- 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.

Yes, I would think so. However, I can see a plugin adding a new hook into CGI::App, and hence it would need to call 'call_hook' in that case.


If you look at the new C::A::P::TT module, you will see that I added two new hooks specific to that module (tt_pre_process and tt_post_process) that get called before and after a template gets processed. These hooks get called during every call to tt_process. But they work like the current hooks in that you can only have one method that is called (unless you play with SUPER::). If we carefully craft the patch, we could make it possible to have the hooks system extensible so that new hook locations could be added through plugins.

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.

Fair enough.

Cheers,

Cees

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