Re: Request for more contextual data to filters and coderef vars
Sam Tregar <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 25 Feb 2006, Brad Choate wrote: > Hi all-- brand new to the list, but I've been using HTML::Template for > some time. Just to quickly introduce myself... I work at Six Apart as > one of the engineers of Movable Type. MT uses HTML::Template for all > of its application UI. Hey Brad, good to meet you. I believe I owe my mention in the book "We Blog" to Six Apart. I'll let you decide if that's a good thing or not. > First, for filters: a filter should be able to determine what file is > currently being processed, if the contents of the template did come > from a file. I guess that makes sense. I'm curious though - what are you planning to do with this feature? > Second, for template vars that are coderefs. > > To me, these are a bit limited since the coderef has no way to > determine it's context. I'm envisioning a scenario like this: > > <TMPL_LOOP NAME=X> > <TMPL_VAR NAME=CODE_FOO> > </TMPL_LOOP> > > The coderef associated with 'code_foo' is called for each iteration of > the array in parameter 'x', but 'code_foo' has no way to access the > active row of data. This seems less obviously useful to me. If the data-structure for loop X is so complicated then why make it more complicated by using code-refs? Why not just bake it all into the structure you pass to param() in the first place? I should admit, I very rarely use code-ref params in my work. They seem to have a very limited utility. I used them to implement HTML::Template::Expr, but I wouldn't say I'm proud of that fact! -sam ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642