GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::UnicodeBox::Table(3) User Contributed Perl Documentation Text::UnicodeBox::Table(3)

Text::UnicodeBox::Table - High level interface providing easy table drawing

  my $table = Text::UnicodeBox::Table->new();

  $table->add_header('id', 'name');
  $table->add_row('1', 'George Washington');
  $table->add_row('2', 'Thomas Jefferson');
  print $table->render();

  # Prints:
  # XXXXXXXXXXXXXXXXXXXXXXXXXX
  # X id X name              X
  # XXXXXXXXXXXXXXXXXXXXXXXXXX
  # X  1 X George Washington X
  # X  2 X Thomas Jefferson  X
  # XXXXXXXXXXXXXXXXXXXXXXXXXX

This module provides an easy high level interface over Text::UnicodeBox.

Pass any arguments you would to "new" in Text::UnicodeBox but with the following additions.
split_lines
If set, line breaks in cell data will result in new rows rather then breaks in the rendering.
max_width
If set, the width of the table will ever exceed the given width. Data will be attempted to fit with wrapping at word boundaries.
break_words
If set, wrapping may break words
column_widths
  column_widths => [ undef, 40, 60 ],
  # First column may be any width but the second and third have specified widths
    

Specify the exact width of each column, sans padding and box formatting.

style
  my $table = Text::UnicodeBox::Table->new( style => 'horizontal_double ');
    

You may specify a certain style for the table to be drawn. This may be overridden on a per row basis.

light
All lines are light.
heavy
All lines are heavy.
double
All lines are double.
horizontal_double
All horizontal lines are double, where vertical lines are single.
heavy_header
The lines drawing the header are heavy, all others are light.

  $table->add_header({ bottom => 'heavy' }, 'Name', 'Age', 'Address');

Same as "add_row" but sets the option ('header' => 1)

Draws one line of output with a border on the top and bottom.

If the first argument to this method is a hashref, it is interpreted as an options hash. This hash takes the following parameters:
style (default: 'light')
What style will be used for all box characters involved in this line of output. Options are: 'light', 'double', 'heavy'
alignment
  alignment => [ 'right', 'left', 'right' ]
    

Pass a list of 'right' and 'left', corresponding with the number of columns of output. This will control the alignment of this row, and if passed to "add_header", all following rows as well. By default, values looking like a number are aligned to the right, with all other values aligned to the left.

header_alignment
The header will always be aligned to the left unless you pass this array ref to specify custom alignment.
top
bottom
If set, draw a line above or below the current line.
header
Same as passing "top" and "bottom" to the given style (or the default style "style")

Returns the width of the table if it were rendered right now without additional rows added.

Copyright (c) 2012 Eric Waters and Shutterstock Images (http://shutterstock.com). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

Eric Waters <ewaters@gmail.com>
2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.