Subject: | wanted/missing methods: column_width, align and column_align |
Recently at perlmonks ( http://perlmonks.com/index.pl?node_id=233466 )
I came up with the following snippet
#!/usr/bin/perl
use strict;
use warnings;
use Text::Table;
print "==== Monks I think rock! ====\n\n";
my $tB = Text::Table->new(
\'[ ',
{
title => 'Name',
align => 'left',
},
\" | ", #separator
{
title => ' ',
align => 'right',
},
\' ]',
);
$tB->load(
[ steves => 'rocks plenty, found Text::Table'],
[ 'Anno Siegel' => 'rocks plenty, after all he wrote Text::Table'],
);
print $tB->title();
print $tB->rule('#','#');
print $tB->body(0);
# bugger, a buG
# print $tB->title_rule('.');
print $tB->rule();
print $tB->body(1);
print $tB->body_rule('.');
print $tB->rule();
# this one ought to be called "align" or body_align
# and part of the package
print Text::Aligner::align(
right =>
( ' ' x ( $tB->width() - length '... and many more ' ) )
. '... and many more ' ),"\n";
# and there ought to be one called column_align
# which would work the same, except would align the thing within
# the specified column, as in:
# print $tB->column_align(1,'left',' ... and many more ');
__END__
==== Monks I think rock! ====
[ Name | ]
##############################################################
[ steves | rocks plenty, found Text::Table ]
[ | ]
[ Anno Siegel | rocks plenty, after all he wrote Text::Table ]
[.............|..............................................]
[ | ]
... and many more
Now I hated having to mess with Text::Aligner,
which I why the methods align and column_align are missing.
I couldn't align a piece of text in a particular column,
which is why column_width is missing
(i didn't wanna involve Data::Dumper in finding that info out,
that's what APIs are for).
Now if column_align exists, column_width might not be really
neccessary, but it would still be nice.
I hope you can see that these methods ought to be included.
P.S.
I realized after posting that you're probably not a perl monk, oh well.