Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^4: HTML::Template, pseudo trees and indention.

by maverick (Curate)
on Jan 10, 2006 at 16:03 UTC ( [id://522220] : note . print w/replies, xml ) Need Help??

in reply to Re^3: HTML::Template, pseudo trees and indention.
in thread HTML::Template, pseudo trees and indention.

/me reads question again.

...only for strict definitions of "twist". He already has the tree as an array. He already has the depth of the nodes in the tree. The only thing he's missing is the not-so-magical trick of having H::T produce html to create the changes in depth. For that you need to know how much and which way the depth changes between any two nodes and then use a tmpl_loop to generate the right number of opens / closes.

Granted the code needs comments, but impossible to follow is a stretch. jeffa figured it out sans comments in the time it took me to type this respone...can't be that bad :)


Replies are listed 'Best First'.
Re^5: HTML::Template, pseudo trees and indention.
by dragonchild (Archbishop) on Jan 10, 2006 at 16:47 UTC
    jeffa understanding something and your average programmer understanding it are two completely different things. You see, jeffa actually has (at least) half a brain and is willing to use it. :-)

    I might have been a little harsh in my response. But, I feel that BUU's tree representation, while compact, is mostly unusable. Given a more useful tree representation (such as Tree or Tree::Simple), one is inevitably led to use one of the tools that already exist for reformatting objects of those classes (which I list in my original response). Why reinvent the wheel?

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      hehehee. why? simple. You said it "couldn't be done, period".

      Naturally, we can debate the merits of near a infinite number of possible solutions (TIMTOWTDI after all), but that wasn't the point :)