Upstream ChangLog:
1.65 Mon Jul 23 20:16:08 PDT 2012
Finish the "Perl Data::Table Cookbook", should be a good learning material.
To download, visit https://sites.google.com/site/easydatabase/
Polish Data::Table::Excel for CPAN upload.
Minor patches to the code.
1.64 Sun Jul 8 22:01:17 PDT 2012
Add $keepRestCols to Data::Table::group();
We introduce new constants for fromCSV/fromTSV/fromFile/csv/tsv.
Data::Table::OS_UNIX = 0;
Data::Table::OS_PC = 1;
Data::Table::OS_MAC = 2;
Add method reorder(), redefine column orders
Add method melt() and cast(), concept borrowed from Reshape package in R
Add method each_group(), so one can apply a custom method to rows sharing the same key
Made a seemingly backward incompatible change to pivot()
pivot($colToSplit, $colToSplitIsNumeric, ...) is changed to
pivot($colToSplit, $colToSplitIsStringOrNumber, ...)
What is now pivot($colToSplit, $Data::Table::STRING, ...), where Data::Table::STRING has a value of 1,
was equivalent to pivot($colToSplit, 0, ...) in <= 1.63.
However, the $colToSplitIsStringOrNumber is now auto-guessed within the code, so the change is not very relevant.
Most existing code should run fine, without change.
Patch group(), piviot() to distinguish keys between empty string and undef.
Patch subTable() to take row mask array when {useRowMask=>1} is provided.
1.63 Tue Jun 12 17:05:43 PDT 2012
In this release, we patch addCol, delCol, addRow, rowMerge, colMerge to for an empty table
We introduce new methods isEmpty(), hasCol(), moveCol($colID, $newColIdx)
We introduce new constants for Data::Table::new()
Data::Table::ROW_BASED
Data::Table::COL_BASED
1.62 Fri May 25 11:40:09 PDT 2012
In this release, we address a few pain points
Data::Table::colMerge, update to support new options
{ renameCol => 1}
If specified, duplicate column names in the second table is automatically renamed (by appending _2) to avoid conflict
We introduce some constants, so we have fewer numbers to remember.
Data::Table::NUMBER
Data::Table::STRING
Data::Table::ASC
Data::Table::DESC
for sort(), you can use $t->sort('col2', Data::Table::NUMBER, Data::Table::DESC); it is equivalent to $t->sort('col2', 0, 1);
Data::Table::INNER_JOIN
Data::Table::LEFT_JOIN
Data::Table::RIGHT_JOIN
Data::Table::FULL_JOIN
for join(), you may use $t->sort($t2, Data::Table::FULL_JOIN, ['col1'], ['col1']);
it is equivalent to $t->sort($t2, 3, ['col1'], ['col1']).
match_string, match_pattern have been generating @Data::Table::OK, which is a class-level array.
$t->match_pattern() will now also store the results (array ref) in $t->{OK}, that should be used in the future.
However, @Data::Table::OK is still supported for compatibility reasons.
This is not a pain point, but conceptually nicer to be localized.
match_pattern_hash() is added. The difference is each row is fed to the pattern as a hash %_. In the case of
match_pattern, each row is fed as an array ref $_. The pattern for match_pattern_hash() becomes much cleaner.
If a table has two columns: Col_A as the 1st column and Col_B as the 2nd column, a filter "Col_A>2 AND Col_B<2"
is written before as
$t->match_pattern('$_->[0] > 2 && $_->[1] <2');
where we need to figure out $t->colIndex('Col_A') is 0 and $t->colIndex('Col_B') is 1, in order to build the pattern.
Now you can use column name directly in the pattern:
$t->match_pattern_hash('$_{Col_A} >2 && $_{Col_B} <2');
This method creates $t->{OK}, as well as @Data::Table::OK, same as match_pattern().
Data::Table::rowMerge, update to support new options
{ byName =>1, addNewCol => 1}
If byName is 1, rows in the second table are appended by matching their column names, so that the second table
can have columns in a different order.
If addNewCol is 1, columns not exist in the first table will be automatically added.
addNewCol is best used with byName. If used alone, addNewCol will just patch the two tables so that they have
the same number of columns.
Data::Table::subTable, update internal to remove side effect on column header array
Data::join add support for an option {renameCol => 1}.
If specified, duplicate column names in the second table is automatically renamed (by appending _2) to avoid conflict
1.61 Mon Feb 27 21:07:55 PST 2012
Data::Table::fromSQL now can take DBI::st instead of a SQL string. This is introduced, so that
variable binding (such as CLOB/BLOB) can be done outside the method.
1.60 Sat Feb 25 19:26:46 PST 2012
Data::Table::addRow now also can take a hash reference. Hash keys are column names,
undef will be the value, if a column name is not found in the hash.
Suggested by Federico
1.59 Sun Feb 5 00:20:00 PST 2012
I have never checked those CPAN ticket, happened to discover them and address them in this version.
Update document, explain Data::Table::fromCSV(\*STDIN, 1) can be used to read table from STDIN.
Add tbody and thead to Data::Table::html, if it's portrait.
Suggested by Ken Rosenberry.
Modify Data::Table::html and Data::Table::html2, so that it can accept coloring via CSS
The color now can be either specified as an array as before, or as three CSS class names
Suggested by Xavier Robin
1.58 Thu Feb 2 20:33:03 PST 2012
Patch join(), prior version of join considers two NULL keys to be equal
update document, clarify that rowMerge assumes table columns in the same order
Thanks to Ulrik Stervbo.
1.57 Thu Apr 23 15:22:36 PDT 2009
Patch pivot(), it throws warning before, when colToFill is undef.
1.56 Fri Aug 22 15:53:29 PDT 2008
When the first line in a TSV is not a header, but contains strings such as \t.
The program will not transform \t to a tab.
Modify fromTSV, so that \t, \N (etc) transformation is optional.
Add transform_element flag to fromTSV method to turn on/off the transformation.
Thanks to Bin Zhou.
1.55 Mon May 5 10:29:44 PDT 2008
Patch parseCSV. fromFile guesses the wrong delimiter if some ending columns are empty.
to trigger/signal a rebuild for the transition 5.10.1 -> 5.12.1.
The list of packages is computed by finding all packages which end
up having either of PERL5_USE_PACKLIST, BUILDLINK_API_DEPENDS.perl,
or PERL5_PACKLIST defined in their make setup (tested via
"make show-vars VARNAMES=..."), minus the packages updated after
the perl package update.
sno@ was right after all, obache@ kindly asked and he@ led the
way. Thanks!
to trigger/signal a rebuild for the transition 5.8.8 -> 5.10.0.
The list of packages is computed by finding all packages which end
up having either of PERL5_USE_PACKLIST, BUILDLINK_API_DEPENDS.perl,
or PERL5_PACKLIST defined in their make setup (tested via
"make show-vars VARNAMES=...").
1.54 Sun Feb 10 21:35:02 PST 2008
Modify fromFileGetTopLines method, remove dependency on bytes
bytes::substr causes infinite loop in some older version of perl
1.53 Thu Jan 3 21:13:40 PST 2008
add "use bytes" to Table.pm
Just patched test.pl, because some OS cannot open in-memory file.
1.52 Fri Dec 14 11:48:42 PST 2007
1.51 Wed Dec 12 15:36:22 PST 2007
1. Add a class methods Data::Table::fromFile(file_name), which can
guess the file format and call fromCSV/fromTSV internally.
fromFile relies on the following new methods
fromFileGuessOS(file_name)
fromFileGetTopLines($file_name, $OS, $lineNumber)
fromFileIsHeader($string)
fromFileGuessDelimiter($arrayRefToLines)
to figure out if the input file is from UNIX/PC/MAC, whether its first
row contains column headers, and whether it uses ",", "\t" or ":" as
field delimiters.
It then calls either fromCSV or fromTSV to return the table object.
$t = Data::Table::fromFile("myFileName_CSVorTSV_HeaderOrNoHeader_UNIXorPCorMAC
");
Please refers to the updated document for details.
2. When fromFile/fromCSV/fromTSV reads from an empty file, it returns
an undef object, rather than quit.
3. Provide more informative error message, when invalid column header is found
.
4. fixed a bug in 1.51 where fromFileGuessOS failed in Windows
Thanks to patches provided by "whitebell".
spreadsheet data among disk files, database, and Web publishing.
A table object contains a header and a two-dimensional array of scalars.
Three class methods Data::Table::fromCSV, Data::Table::fromTSV, and
Data::Table::fromSQL allow users to create a table object from a CSV/TSV
file or a database SQL selection in a snap.