Tabular Data, spreadsheets and cell references

Since Cantella::JobQueue has been put on hold after the discovery of Beanstalkd, I've moved on to other projects. The first on my list was to add some new views to a Reaction-based application. Specifically, I needed a couple of ways to export tabular data. I needed to display it as inline XHTML tables, export it as PDF sheets and allow for spreadsheet downloads. Because none of the current offerings gave me the flexibility I wanted, I decided to write my own.

Cantella::Data::Tabular is a library for working with (surprise, surprise) tabular data. It contains three main objects, so far. Cells, rows and tables. A table has zero or more rows, and row has zero or more cells and a cell has zero or one value. Additionally, cells will be able to store certain meta-data to facilitate round-trip conversions from certain formats like ".xls". One of the decisions I made from the start was to disallow cells with 'undef' as a value. Cells can either have a value, which must be defined, or have no value. Additionally, I decided that I wanted different rows to be able to have a different number of columns. Lastly, I decided that the whole library should be completely unaware of what cell values mean. That means no references, no functions and no ranges. Values are simply values and it should be up to a higher-level library to decipher exactly what those values mean or don't mean. I did, however, build in cell-level type-constraints.

The library may seem limited, and may not grow to be expanded beyond the most basic needs, but that's the way I want it. Exporters and importers that write or read from Excel / CSV / HTML / PDF files will be made available separately as they become necessary. What I don't want to end up with is a spreadsheet library. I wouldn't mind building another library on top of C::D::T that is able to perform basic spreadsheet functions, but it's a slippery slope to go down.

As of right now, the library has basic tests and is almost fully documented. It hasn't been released to CPAN yet, but it will as soon as it does something useful. I just wanted to let people know this thing exists and invite any comments, suggestions, feature requests or criticisms you might have.

Leave a comment

About Guillermo Roditi

user-pic I blog about Perl.