Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Creating dynamic HTML tables based on user-actions

by McDarren (Abbot)
on Feb 14, 2006 at 13:17 UTC ( #530110=perlquestion: print w/replies, xml ) Need Help??

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:

  • one or more datasets
  • several fields and associated properties, eg. source, datatype (for sorting), display order, field alignment, hyperlink URL, etc, etc..
  • other "general" properties, such as shading colour for alternate rows

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://530110]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2022-01-28 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (72 votes). Check out past polls.

    Notices?