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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I am looking for comments on a new Perl module. The purpose of the module is to take a data set (e.g. from a DB query), apply a bunch of formatting rules, and render the resulting information in the form of an HTML table.

Why this module?

For reports delivered via the web, it is often desirable to be able to apply data-dependent formatting rules, such as:

  • shading every second row to make reading easier
  • highlighting table cells (or rows, or columns) when some condition is fullfilled (e.g. when the value of cell is outside of some range)
  • passing the content through some random formatting filter (such as sprintf(...) or substr(...))

It is often also desirable to be able to sort the data (on a random column) or to restrict the set of columns included in the report.

It is quite painful to build and apply such rules in an ad-hoc fashion while building the HTML table from a data set. (In particular when working on a one-off report which should take no more than half an hour to write.)

Hence a module to take care of all of that.

Proposal:

I have put together a module (tentatively named HTML::Dashboard), which allows the programmer to specify a number of formatting rules, which will be applied to the data as it is rendered into HTML. The module is currently in alpha, and I am looking for comments (in particular in regards to usability, features, documentation, bugs).

The best way to get an idea of what the module (currently) can do is to look at some examples. I put together a "gallery" show-casing the most important features. You can find it here: Gallery

The POD can be found here: Documentation

and the download here: Download

Questions:

Feel free to take a look and let me know what you think. In particular, I'd like to know: Is this useful? And does it work?

Is the documentation understandable (the API is uncomfortably large, in my opinion)?

Is anything missing?

And finally, I am looking for comments on the proposed module name. It's not perfect - any better ideas?

Thanks!


Responses to Comments

Thanks everyone for your comments.

The first thing I took away from the comments was that my priority naming convention "red/yellow/green" is confusing. I think this makes sense, I will change the API to "hi/med/low". (The rationale for the original naming was that in a dashboard you often want to show whether something is "in the red" or "in the green".)

I also wanted to respond to two questions which seemed to be raised several times: Why not CSS? And: Why not a templating solution?

To answer the first: All of this is done through CSS --- but I have to be able to insert the appropriate class- or style-attributes into the cell tags, based on the value of the data. This is what this module does!

A similar argument holds for templates. Templates establish the layout of a table from the outset, which makes it hard to do cell-content-dependent formatting from within the template. And it is simply not convenient to build templates with lots of conditional code in the template --- I know, having used HTML::Template quite extensively (and liking it a lot: cf. an article I did for Perl.com on Filters within HTML::Template.)

Again, thanks for your comments.


In reply to RFC: HTML::Dashboard (Spreadsheet-like formatting for HTML tables) by janert

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-23 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found