See above for my thoughts on "pre" and "post". However, I like the idea
of having a special hook in load_tmpl() that receives the template
object.
Here's a "use case":
I have code which I think is generally useful that adds all my
configuration variables to each template, naming them like:
cfg_foo_name
Now I do this through sub-classing load_tmpl(). But that means to share
the code that way, people have to replace or create their own load_tmpl
function. With a hook there, they could simply 'use' a plugin for this,
assuming they get their config data through one of the other 'config'
plugins I would support.
I was just going to ask for a use case - thanks, Mark!
Currently CAP::TT and my own AnyTemplate module both just call runmodes
for the template pre- and post-processing functions, and I was
struggling to figure out why it would be an improvement to change these
into callbacks.
But the idea of being able to create template pre- and post-processors
as bona fide CA::Plugins answers that question.
(Also, for the built-in load_tmpl function, there are no pre- and
post-process hooks at all yet, so that's another reason.)
on_error (called when something die()s?),
I like having some kind of error hook. Mucking about with $SIG{__DIE__}
can be problematic. For instance, if you use CGI::Carp and
CAP::LogDispatch, you have to be careful to chain your handlers so both
get called when something dies.
And even then, it can cause problems with other modules. For instance,
Apache::SessionX (perhaps foolishly) does some important things at
DESTRY time, and it got very confused when I set a bunch of custom
$SIG{__DIE__} handlers.
As an aside, is there a reason that error_mode only catches errors in
run modes, and doesn't catch errors elsewhere (e.g. in setup or prerun)?
Michael
Michael Graham <magog (AT) the-wire (DOT) com>
YAPC::NA 2005 Toronto - http://www.yapc.org/America/ - na-help (AT) yapc (DOT) org
Web Archive: @lists.erlbaum.net/
To unsubscribe, e-mail: cgiapp-unsubscribe (AT) lists (DOT) erlbaum.net
For additional commands, e-mail: cgiapp-help (AT) lists (DOT) erlbaum.net