http://qs321.pair.com?node_id=530110

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

Howdy :)

More than once in the past, I have found myself having to dynamically generate (near) real-time summaries of random data in HTML table form. Up until now, I've been hand-rolling my own solutions. But I've found myself re-using a lot of code and I'm wondering if there may already be a module that does most of what I need. I'll admit up-front that I've only had a cursory look through CPAN. Modules such as HTML::Table, HTML::Table::Compiler and HTML::QuickTable caught my eye, but I'm not sure that any of them are quite right.

Generally, I will be working with two (or more) distinct (but related) datasets. One will be a bunch of metadata - for example a list of hosts and associated properties (ip address, location name, country, etc). This data would normally come from a database.

The second set will be real-time data collected from these hosts. This data would typically be a result of parsing a number of logfiles.

A good example of this was MRTG data collected from several hosts. In this case, I needed to present a summary table listing all hosts and associated data, and then allow several user-defined actions - such as sorting/filtering and displaying/not displaying optional fields.

As I said, I already have my own hand-rolled solution for this, but every time I "re-use" it I inwardly cringe a little and can't help feeling that I keep re-inventing the wheel.

I guess what I am looking for is a general framework whereby I can arbitrarily define:

So my question is: Is there a module available that would provide a good generic framework to meet the needs I've outlined above?

(If there isn't, perhaps I'll take what I've already done and have a go at turning it into a module, because (at least for me) I believe it could be quite useful)

Thanks,
Darren :)

  • Comment on Creating dynamic HTML tables based on user-actions

Replies are listed 'Best First'.
Re: Creating dynamic HTML tables based on user-actions
by merlyn (Sage) on Feb 14, 2006 at 13:40 UTC
      Just to ease the very first introduction to Catalyst: I noticed somebody is very happy with Catalyst.
Re: Creating dynamic HTML tables based on user-actions
by santonegro (Scribe) on Feb 17, 2006 at 22:43 UTC
    You might also look at Data::Table.

    Also, it sounds to me like you want to mix/match multiple table generation/manipulation strategies for the same basic piece of table HTML. HTML::Seamstress is oriented towards object-oriented HTML manipulation via TreeBuilder. In particular the table2() call in HTML::Element::Library (which Seamstress-style HTML trees are subclassed to) can be called in a number of ways to flexibly unroll HTML tables.