Re: TT's support for methods and complex structures. Why not?

Sam Tregar <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
On Mon, 18 Jul 2005, Mark Stosberg wrote:

> In the current CGI::Application scheme, we solve this with mix-ins and
> hooks for callbacks at various points. H::T seems rather mature already,
> and I'm not suggesting making these kind of extensions to it. This seems
> like a case where modifying the core strikes me as reasonable.

I think I'd take a patch to add a callback system like CGI::App has.
I doubt it would be hard at all.

> > Yes, I think that would be the easiest way.  HTML::Template::Expr
> > exploits code-ref variables to offer function calls, so why not
> > methods too?
> 
> Are you suggesting that the method technique may make sense to add to
> HTML::Template::Expr ? 

Possibly.  The bar for new features in ::Expr is pretty low.  There's
already so much in there not to like that a little more can't hurt!

> The template system has to know what 'defined' means here to parse it. 
> I'm suggesting:
> 
>  <TMPL_IF foo.is_defined>
> 
> As now, we just need to check to see if we have "foo" to use, and
> quickly check to see to if it's a object or a complex data structure to
> see what to do with the bit after the dot.

I really dislike systems that try to collapse hash dereferences and
method calls into a single syntax.  Petal does this and it drives me
nuts - I can never figure out what I'm looking at from the template.
And it does matter because methods may have side-effects and hash
derefs don't.

-sam


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.