Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by dragonchild (Archbishop)
on Jan 10, 2006 at 15:51 UTC ( #522215=note: print w/ replies, xml ) Need Help??


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

*claps sardonically* I was waiting for that response. You did it with H::T, not within H::T. Your node is an excellent example of twisting the problem to suit the answer. Not only is your template nearly unreadable the first 3 times one reads it, but your code is nearly impossible to follow as well. The point wasn't to see if you could code a solution that involves H::T. The point was to see if H::T could provide a solution.

And, yes, any recursive solution can be written iteratively. That doesn't mean that H::T can handle it any better.


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?


Comment on Re^3: HTML::Template, pseudo trees and indention.
Re^4: HTML::Template, pseudo trees and indention.
by maverick (Curate) on Jan 10, 2006 at 16:03 UTC
    /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 :)

    /\/\averick

      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 :)

        /\/\averick

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522215]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-09-20 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (153 votes), past polls