История изменений
Исправление Lavos, (текущая версия) :
1.pl:
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV_XS;
use Text::SimpleTable;
my $csv = Text::CSV_XS->new({sep_char => ";"});
my $tbl = Text::SimpleTable->new(10, 10);
while (<>) {
if ($csv->parse($_)) {
$tbl->row($csv->fields);
$tbl->hr if !eof();
}
}
print $tbl->draw;
111111;"test...test...test"
222222;"test"
333333;"very looooooooooooooooooooong line"
$ ./1.pl <1.csv
.------------+------------.
| 111111 | test...te- |
| | st...test |
+------------+------------+
| 222222 | test |
+------------+------------+
| 333333 | very looo- |
| | ooooooooo- |
| | ooooooooo- |
| | ng line |
'------------+------------'
use Text::SimpleTable;
добавить:
$Text::SimpleTable::WRAP='';
Исходная версия Lavos, :
1.pl:
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV_XS;
use Text::SimpleTable;
my $csv = Text::CSV_XS->new({sep_char => ";"});
my $tbl = Text::SimpleTable->new(10, 10);
while (<>) {
if ($csv->parse($_)) {
$tbl->row($csv->fields);
$tbl->hr if !eof();
}
}
print $tbl->draw;
111111;"test...test...test"
222222;"test"
333333;"very looooooooooooooooooooong line"
$ ./1.pl <1.csv
.------------+------------.
| 111111 | test...te- |
| | st...test |
+------------+------------+
| 222222 | test |
+------------+------------+
| 333333 | very looo- |
| | ooooooooo- |
| | ooooooooo- |
| | ng line |
'------------+------------'