[htmltmpl] TT's support for methods and complex structures. Why not?
Brought to you by:
samtregar
From: Mark S. <ma...@su...> - 2005-07-18 18:52:13
|
I hope this isn't a broken-record question. There are a couple features of TT that seem reasonable to support, and seem at first glance like things that an be added while maintaining compatibility. 1. Support for complex data structures. Flattening is no longer necessary to do a separate step. It's like H::T users are able to skip this step anyway. We either do it by hand, or use something like Data::Grouper. In TT, if you give it a hashref that looks like { a => { b => c} } Then you can directly access "c" as "a.b.c". I like that. 2. Method calls. In TT you can pass this into your template: shopcart => My::Cool::Shopping::Cart->new(), And then access methods on the shopping cart object like this shopcart.total To me, these additions wouldn't violate the integrity of H::T's philosophy, which I interpret as being about keeping the tag language as simple as possible. They simply give the programmers more power and freedom expression, and can help prevent extra hoop jumping when you have an complex data structure or an object that need to hook up with the template anyway. Mark |