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

People
Owner: Nobody in particular
Requestors: stephan.hradek [...] eco.de
Cc:
AdminCc:

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 [...] rt.cpan.org" <bug-Text-Table [...] rt.cpan.org>
From: Stephan Hradek <stephan.hradek [...] eco.de>
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.