Re: [htmltmpl] RFC: Conditional TMPL_INCLUDE
Brought to you by:
samtregar
From: Mark F. <mar...@ea...> - 2005-01-07 18:30:05
|
Matthew, I second Keith's request. Your feature to <tmpl_incl> a variable-substituted filename would be valuable to me. But, I'm not comfortable departing from H::T. Sam, I'm not a big object guy. Subclassing H::T is probably beyond my capability. However, if you think it would be useful to have a "persistent evaluation" of the *cached* template (so that the partially-evaluated template is returned with each subsequent "new" method calls), I hope you'll keep it in mind if/when H::T is enhanced. The only complication I can think of is that the "new" method would have to provide some kind of result indicating that it read the template from disk, not cache (so the caller can reinitialize the cached copy). I can get around this by by caching my own template object. Instead of calling "new" with each display of the page (and relying upon any of H::T's caching mechanisms), I can store the template in $my_template_hash{$visitor_language} (once, when it is found to be undef), perform my one-time language-specific evaluation upon that template, and then use that template for each redisplay of the page. The only problem here is that I have to be aware of anything that might be optionally evaluated. Things that default to a certain display. I have to always evaluate them to be sure they don't have a non-default value when they should be default (that sounds confusing!). Sorry if this is a dumb question, but is there an easy way I could clone the template object in $my_template_hash{$visitor_language}, perform my single display-specific evaluations upon it (without disturbing the original object), and then reclone it for the next display (discarding the earlier clone)? If there is a way, in your opinion would this be more or less efficient than me performing my own re-evaluation of things that otherwise would be default values (i.e., the problem mentioned in the previous paragraph)? Thanks! Mark ----- Original Message ----- From: "Keith Jackson" <kja...@ey...> To: "Sam Tregar" <sa...@tr...> Cc: "Mathew Robertson" <mat...@re...>; "Mark Fuller" <mar...@ea...>; "HTML::Template users" <htm...@li...> Sent: Wednesday, January 05, 2005 11:40 AM Subject: Re: [htmltmpl] RFC: Conditional TMPL_INCLUDE > OK, I understand. So I guess my question is redirected to Mathew, could > you subclass H::T and put your version on CPAN? > > Thanks! > > PS. IMHO It doesn't get said enough, H::T is a GREAT module and all the > people involved deserve tons of credit! Thanks and have a great New > Year. > > Keith > On Wed, 2005-01-05 at 13:07, Sam Tregar wrote: > > On Wed, 5 Jan 2005, Keith Jackson wrote: > > > > > Your version has some nice features that I could use, especially the > > > recursive HTML::Template invocation. Is there a reason why Sam has > > > not included your mods into the CPAN version? > > > > The discussion of these changes is available in the mailing-list > > archive. If memory serves I didn't think that most of them required > > changes to HTML::Template itself. My feeling is that if > > HTML::Template::Expr could be done without changes to HTML::Template > > then there's really no limit on the changes that can be accomplished > > by a sub-class using filter. > > > > Put simply, HTML::Template has suffered from feature-creap through its > > life and it's nearly at the breaking point now. The current code-base > > won't remain maintainable with many more features added without a > > major rearchitecture. Someday maybe I'll do that and then all kinds > > of extension will be easier... > > > > -sam > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by: Beat the post-holiday blues > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > > _______________________________________________ > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users > -- > Keith Jackson <kja...@ey...> > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |