1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
NAME
Text::MarkdownTable - Write Markdown syntax tables from data
SYNOPSIS
my $table = Text::MarkdownTable->new;
$table->add({one=>"a",two=>"table"});
$table->add({one=>"is",two=>"nice"});
$table->done;
| one | two |
|-----|-------|
| a | table |
| is | nice |
Text::MarkdownTable->new( columns => ['X','Y','Z'], edges => 0 )
->add({a=>1,b=>2,c=>3})->done;
X | Y | Z
--|---|--
1 | 2 | 3
DESCRIPTION
This module can be used to write data in tabular form, formatted in
MultiMarkdown syntax. The resulting format can be used for instance to
display CSV data or to include data tables in Markdown files. Newlines
and vertical bars in table cells are replaced by a space character and
cell values can be truncated.
CONFIGURATION
file
Filename, GLOB, scalar reference or IO::Handle to write to (default
STDOUT).
fields
Array, hash reference, or comma-separated list of fields/columns.
columns
Column names. By default field names are used.
widths
Column widths. By default column widths are calculated automatically
to the width of the widest value. With given widths, the table is
directly be written without buffering and large table cell values
are truncated.
header
Include header lines. Enabled by default.
edges
Include border before first column and after last column. Enabled by
default. Note that single-column tables don't not look like tables
if edges are disabled.
condense
Write table unbuffered in condense format:
one|two
---|---
a|table
is|nice
Note that single-column tables are don't look like tables on
condense format.
METHODS
add( $row )
Add a row as hash reference. Returns the table instance.
streaming
Returns whether rows are directly written or buffered until "done"
is called.
done
Finish and write the table unless it has already been written in
"streaming" mode.
SEE ALSO
See Catmandu::Exporter::Table for an application of this module that can
be used to easily convert data to Markdown tables.
Similar table-generating modules include:
Text::Table::Tiny
Text::TabularDisplay
Text::SimpleTable
Text::Table
Text::ANSITable
Text::ASCIITable
Text::UnicodeBox::Table
Table::Simple
Text::SimpleTable
Text::SimpleTable::AutoWidth
AUTHOR
Jakob Voß <jakob.voss@gbv.de>
COPYRIGHT AND LICENSE
Copyright 2014- Jakob Voß
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|