+ if ($border) {
+ if ($i == 0 && ($column_count == 1)) {
+ if ($utf8) {
+ $formatstring .= "│ %-${cutoff}s │";
+ $borderstring_t .= "┌─" . ('─' x $cutoff) . "─┐";
+ $borderstring_m .= "├─" . ('─' x $cutoff) . "─┤";
+ $borderstring_b .= "└─" . ('─' x $cutoff) . "─┘";
+ } else {
+ $formatstring .= "| %-${cutoff}s |";
+ $borderstring_m .= "+-" . ('-' x $cutoff) . "-+";
+ }
+ } elsif ($i == 0) {
+ if ($utf8) {
+ $formatstring .= "│ %-${cutoff}s ";
+ $borderstring_t .= "┌─" . ('─' x $cutoff) . '─';
+ $borderstring_m .= "├─" . ('─' x $cutoff) . '─';
+ $borderstring_b .= "└─" . ('─' x $cutoff) . '─';
+ } else {
+ $formatstring .= "| %-${cutoff}s ";
+ $borderstring_m .= "+-" . ('-' x $cutoff) . '-';
+ }
+ } elsif ($i == ($column_count - 1)) {
+ if ($utf8) {
+ $formatstring .= "│ %-${cutoff}s │";
+ $borderstring_t .= "┬─" . ('─' x $cutoff) . "─┐";
+ $borderstring_m .= "┼─" . ('─' x $cutoff) . "─┤";
+ $borderstring_b .= "┴─" . ('─' x $cutoff) . "─┘";
+ } else {
+ $formatstring .= "| %-${cutoff}s |";
+ $borderstring_m .= "+-" . ('-' x $cutoff) . "-+";
+ }
+ } else {
+ if ($utf8) {
+ $formatstring .= "│ %-${cutoff}s ";
+ $borderstring_t .= "┬─" . ('─' x $cutoff) . '─';
+ $borderstring_m .= "┼─" . ('─' x $cutoff) . '─';
+ $borderstring_b .= "┴─" . ('─' x $cutoff) . '─';
+ } else {
+ $formatstring .= "| %-${cutoff}s ";
+ $borderstring_m .= "+-" . ('-' x $cutoff) . '-';
+ }
+ }
+ } else {
+ # skip alignment and cutoff on last column
+ $formatstring .= ($i == ($column_count - 1)) ? "%s" : "%-${cutoff}s ";
+ }