On 2005-02-03, Cees Hek <suppressed> wrote:
>
> - automatic template filename generation -- the tt_process method can
> automatically generate a template filename based on the runmode that
> called it (eg calling $self->tt_process($tt_vars) from runmode
> 'my_runmode' in module 'My::App' would automatically load a template
> with a filename of My/App/my_runmode.tmpl). See docs for more info.
Interesting idea. This could be useful to support in load_tmpl() as
well, as a way to provide more structure to how templates are named.
I have a question about the implementation. I was wondering why
'current_run_mode()' was not used to figure out the run mode. I saw
drawbacks to both solutions.
With the current implementation, it won't work if you try to use it
from a function called by a run mode, instead of calling it directly
from a run mode.
That could prehaps be improved if you walk up the caller stack until you
you find a method that is mentioned in the run_modes() hash. If nothing
is found, it's probably the anonymous subroutine case.
Hmm, I wonder what this code does now with run modes that are anonymous
subs. :)
Using current_run_mode() would mean you won't have to worry about nested
sub routine calls, but I don't think it would work right when one
run mode calls another one.
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
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.