shlomif / Text-Table

CPAN Distribution to render text / ASCII-art / Unicode tables
https://metacpan.org/release/Text-Table
ISC License
4 stars 6 forks source link

Table print feature request #8

Open Skeeve opened 5 years ago

Skeeve commented 5 years ago

Hi!

As stated in my other feature request, I just started yesterday using Text::Table.

I was puzzled by another behaviour I did not expect. (This is a copy of https://rt.cpan.org/Public/Bug/Display.html?id=130334)

When I created my table, I also called $tb->rule('-','|');

When I later printed the table, with "print $tb" no rule was printed.

I needed quite some time to figure out that it's required to print like this:

print $tb->title, $tb->rule('-','|'), $tb->body;

Additionally it seems you need to print every row of the table on its own when you want body rules to be printed.

Maybe you can add 2 members:

$tb->add_rule(…) and $tb->add_body_rule(…)

which simply prepare the rules and print them automatically when the table is printed?

And while we are at it, maybe also footer and header rules could be handy to get "framed" tables like

+----+----+
| c1 | c2 |
|====|====|
| A1 | A2 |
| B1 | B2 |
| C1 | C2 |
+----+----+

I do not need it, but I saw that other table modules have this.