-
Notifications
You must be signed in to change notification settings - Fork 3
Data::StaticTable
A StaticTable allows you to handle bidimensional data in a more natural way
Some features:
- Rows starts at 1 (
Data::StaticTable::Position
is the datatype used to reference row numbers) - Columns have header names
- Any column can work as an index
If the number of elements provided does not suffice to form a square or a rectangle, empty cells will be added.
The module provides two classes: StaticTable
and StaticTable::Query
.
A StaticTable can be populated, but it can not be modified later. To perform searchs and create/store indexes, a Query object is provided. You can add indexes per column, and perform searches (grep) later. If an index exists, it will be used.
You can get data by rows, columns, and create subsets by taking some rows from an existing StaticTable.
Basically, an integer greater than 0. Used to indicate a row position in the table. A StaticTable do not have rows on index 0.
You can use [n] to get the full Nth row, in the way of a hash of 'Column name' => data
So, for example
$Q1[1]
Could return a hash like
{Column1 => 10, Column2 => 200.4, Column3 => 450}
And a call like
$Q1[10]<Column3>
would refer to the data in Row 10, with the heading Column3
my $t = StaticTable.new( 3 , (1 .. 15) );
my $t = StaticTable.new(
<Column1 Column2 Column3> ,
(
1, 2, 3,
4, 5, 6,
7, 8, 9,
10,11,12
13,14,15
)
);
Create a StaticTable, by specifying a header (one by one or just by numbers). If you a number, this number of columns will be used, and automatically named as A, B, C ... Z, AA, AB, ...
This will create a spreadsheet-like table, with numbered rows and labeled columns.
If you do not provide enough data to fill the last row, empty cells will be appended.
Shows a summary of the things contained in the StaticTable object. Used for debugging, not for serialization.
Shows the contents of the StaticTable Used for debugging, not for serialization.
Retrieves the content of a cell.
Retrieves the content of a column like a regular List
.
Retrieves the content of a row as a regular List
.
Retrieves the content of a row as a multiple dimension array.
Retrieves the number of cells in the table
Generate a Hash
, where the key is the value of the cell, and the values is a list of row numbers (of type Data::StaticTable::Position
).
Generate a new StaticTable
, using a list of row numbers (using the type Data::StaticTable::Position
)