Hero Zzyzzx has asked for the wisdom of the Perl Monks concerning the following question:

Brethren,

So I'm creating this kick-butt custom legal document management system with CGI::Application, HTML::Template, DBI and other modules.

My next major piece is to create subs that make the recursive, browsable tree of documents.

CGI::Explorer seemed like a good option, but the interface is too "techie," and doesn't work well in all browsers. (it's all but unusable in Netscape 4.77 for *nix). Other cpan searches turned up nada useful.

The node building an HTML based tree UI has some good info, but not much.

Assuming none of y'all have better ideas, my fallback is to create a recursive array of hash refs that gets plugged into HTML::Template <!-- TMPL_LOOP -->'s. Not that this is a bad option, but I was hoping that I wouldn't have to roll-my-own here.

My question(s): Is there something I missed on CPAN?
What pitfalls/feedback do others have about systems like this? How have you done it?

TIA

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

Replies are listed 'Best First'.
Re: Help on Creating HTML tree from hash
by George_Sherston (Vicar) on Sep 22, 2001 at 06:01 UTC
    How have you done it?

    Before I found enlightenment in the monastery I wrote this. (The working version is a perl script that takes input so that you can get the page with the branches of the tree you were looking at before already open: I turned it into html because that was the easiest way to make it viewable. It's also designed to send the names of chosen branches to another window, but I've commented those lines out.)

    It scores over CGI::Explorer in that it doesn't have to make the round trip to the server to open a branch. But it has a couple of disadvantages: (A) it only works in IE - this could (and will) be solved with more javascript; (B) there isn't a facility to update it dynamically: it's for a fairly static menu tree, and I blush to admit that I have a spreadsheet to turn a list of branch names into the relevant HTML.

    So it doesn't do it from a hash. But it could. And this is an additional reason why I post this, because it has been in my mind that this might make a useful CGI module if I could write the perl to generate custom trees on the fly. Would it?

    § George Sherston

      That's pretty cool! It's kind of a big disadvantage to have it only work in IE though. You should look into wddx to provide your javascript data structures for you for this project, should you decide to write something in perl.

      I'm actually looking for a perl-only solution, because it's more important in this case for the menus to work properly, on every browser, than to save on the bandwidth.

      Update: s/perl-only/html-only/

      -Any sufficiently advanced technology is
      indistinguishable from doubletalk.