Skip Menu |

This queue is for tickets about the Text-Table CPAN distribution.

Report information
The Basics
Id: 130333
Status: new
Priority: 0/
Queue: Text-Table

Owner: Nobody in particular
Requestors: stephan.hradek [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: Alignment Feature request
Date: Sun, 18 Aug 2019 08:37:17 +0000
To: "bug-Text-Table [...]" <bug-Text-Table [...]>
From: Stephan Hradek <stephan.hradek [...]>
Hi! I just started yesterday using Text::Table and was a bit puzzled as the output wasn't what I expected. This is the smallest example I can create to illustrate my non-understanding: my $tb= Text::Table->new( { title => 'left' }, \' | ', { title => 'right', align => 'right' }); $tb->add('<','>'); print $tb I got left | right < | > where "<" is clearly NOT right aligned (to my understanding. When I added $tb->add('<<','>>') print $tb I got: left | right < | > << | >> which finally clarified my misunderstanding. Headers are not included in the calculation of the alignment. I worked around this by changing my code to include a sample having the width of the title, so something like this: Text::Table->new( { title => 'left', sample=> '----', }, \' | ', { title => 'right', sample=> '-----', align => 'right', }, ); Maybe it's possible to include a method/parameter to tell the table to include the headers in the width/alignment calculation? -- Stephan
Download smime.p7s
application/pkcs7-signature 2.4k

Message body not shown because it is not plain text.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to