Hi,

I wanted to consult on whether something is actually useful enough to
upload to CPAN. Perhaps I'm simply missing something obvious.

Data::Tabular::Document (for the lack of a better name at the moment)
allows you to create a document with rows, with each row having items. They
are all objects, so you can create them separately and then add them. At
the end you can render it using any one of a few given renderers.

The purpose is dual:
1. Separate the view from the logics (as MVC does). So you add a document
and rows and items without caring what the output is. Then you can output
it however you want (CSV/Excel/etc.). This cleans up the code from having
output-specific handling. You just push it in the document, and then pick
the rendering format.
2. Allow composing a row without adding it. I had a situation where I only
knew whether I needed a row or not at the end of a process. By that time,
I've already had to add the items. I could put the row data separately and
at the end of the processing put it in, but if you're using Excel, you need
to add each item separately so it becomes tricky. With this module, I can
create a new Data::Tabular::Document::Row object and add items to it. At
the end, I can decide to $doc->add_row($row_object) if I want to.

Some extra info:
- Each item has "content" and "format". The format is not mandatory but
will be used if you're using Excel rendering and want cell formatting.
- Each row has "items" and "format". The format provides a general
row-level format. The row object maintains the item column so you can just
add and it will column it automatically. You could pick a specific column
for an item when you insert it into a row.
- Each document has "rows". It does the same as the row object to maintain
the index of the row so it stacks them when you add them without needing to
indicate which row number it is.
- You don't have to insert Row objects into a document or Item objects into
a row. If you simply give the data, one will be created for you.
- Each of these objects has an ID, so even if you add an anonymous one
(instead of an actual object) you get the ID back so you can play with it
(like removing it). When you dump the rows, you can get them either with
their IDs or just the rows themselves.
- When you render, you can give parameters that go to the renderer's
constructor.

So the question is: is this totally worthless? Is it useful? It is useful
enough to upload to CPAN? Is there a better, more comfortable/correct way
of doing it?
Any input is very welcome!

S.

Reply via email to