NAME
Table::Simple::Output - generates ASCII output for an Table::Simple object
DESCRIPTION
This class generates the ASCII table output for a Table::Simple object. The output functionality was split to make subclassing easier.
ATTRIBUTES
- column_marker
-
This attribute is the character to mark the beginning or end of a column. The default is ":"
- horizontal_rule
-
This attribute is the character to mark horizontal lines in the table. The default is "="
- intersection_marker
-
This attribute is the character marking the intersection between the column marker and a horizontal rule. The default is "+"
- padding
-
This attribute defines the amount of spaces to put around data rows. The default is 1 space.
- table
-
This attribute is required at construction time. It is the table to be output. It must be an object of type Table::Simple.
METHODS
- center($text, $width)
-
This method takes a text string and a width and centers the text in the width given. It returns the text string padded with spaces to put the text in the middle of the width.
- left_justify($text, $width)
-
This puts text against the left margin of a table cell, padded with spaces until it is the specified width.
- right_justify($text, $width)
-
This method puts text against the right margin of a table cell, padded with spaces until it is the specified width.
- build_row_output( @array )
-
This method returns a scalar string composed of the rows specified in the input @array.
- build_column_name_output
-
This method returns a string scalar composed of column names centered in the width for each column.
- build_table_name_output
-
This outputs the Table::Simple name attribute centered in its own row. It returns a string scalar.
- build_table_output
-
This method returns a string scalar composed of the table name row (if defined), column names, and all row values.
- print_table
-
This method outputs the string scalar from the build_table_output() method to standard out.
LICENSE
Copyright (C) 2010 Mark Allen
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
AUTHOR
Mark Allen <mrallen1@yahoo.com>