NAME Text::Column - format tables from specific array and hash structures SYNOPSIS ##### # Subroutine interface # use Text::Column qw(format_hash_table format_array_table); $table = format_hash_table(\%hash, \@width, \@header); $table = format_array_table(\@array, \@width, \@header); ##### # Object interface # use Text::Column; $table = Text::Column->format_hash_table(\%hash, \@width, \@header); $table = Text::Column->format_array_table(\@array, \@width, \@header); DESCRIPTION The methods in this module are used to generate formated tables from the data in various specific array and hash structures. These subroutines are used in test software. They are used to build simple inventory listings, tracebility listins and such for PODs. Thus, the purpose is not to load them with a lot of word processing features but to keep them bare bones with as little code as possible. Feature creep is prohibited. The last thing need is a blue screen for out of a 100,000 line option ridden, ten layer deep objectize, word processor in the test software. SUBROUTINES format_array_table $formated_table = format_array_table(\@array, \@width, \@header) The *format_array_table* method provides a formatted table suitable for inclusion in a POD. The *\@array* variable references an array of array references. Each array reference in the top array is for a row array that contains the items in column order for the row. The *\@width* variable references the width of each column in column order while the *\@header* references the table column names in column order. format_hash_table $table = format_hash_table(\%hash, \@width, \@header) The *format_hash_table* method provides a formatted table suitable for inclusion in a POD. The *\%array* variable references a hash of references to either arrays or hashes. Each key is the first column of a row. An array referenced by the hash value contains the items in column order for the rest of the row. The keys of a hash referenced by the hash value is the items for the next column in the row. Any other hash value signals the end of the row. The *format_hash_table* method always sort hash keys. The *\@width* variable references the width of each column in column order while the *\@header* references the table column names in column order. REQUIREMENTS Coming soon. DEMONSTRATION ~~~~~~ Demonstration overview ~~~~~ Perl code begins with the prompt => The selected results from executing the Perl Code follow on the next lines. For example, => 2 + 2 4 ~~~~~~ The demonstration follows ~~~~~ => use File::Spec; => use File::Package; => my $fp = 'File::Package'; => my $tt = 'Text::Column'; => my $loaded = ''; => my $template = ''; => my %variables = (); => my $expected = ''; => my $errors = $fp->load_package($tt) => $errors '' => my @array_table = ( => [qw(module.pm 0.01 2003/5/6 new)], => [qw(bin/script.pl 1.04 2003/5/5 generated)], => [qw(bin/script.pod 3.01 2003/6/8), 'revised 2.03'] => ); => $tt->format_array_table(\@array_table, [15,7,10,15],[qw(file version date comment)]) ' file version date comment --------------- ------- ---------- --------------- module.pm 0.01 2003/5/6 new bin/script.pl 1.04 2003/5/5 generated bin/script.pod 3.01 2003/6/8 revised 2.03 ' => my %hash_table = ( => 'module.pm' => [qw(0.01 2003/5/6 new)], => 'bin/script.pl' => [qw(1.04 2003/5/5 generated)], => 'bin/script.pod' => [qw(3.01 2003/6/8), 'revised 2.03'] => ); => $tt->format_hash_table(\%hash_table, [15,7,10,15],[qw(file version date comment)]) ' file version date comment --------------- ------- ---------- --------------- bin/script.pl 1.04 2003/5/5 generated bin/script.pod 3.01 2003/6/8 revised 2.03 module.pm 0.01 2003/5/6 new ' => %hash_table = ( => 'L' => {'L' => undef, 'L' => undef }, => 'L' => {'L' => undef }, => 'L' => {'L' => undef, 'L' => undef }, => ); => $tt->format_hash_table(\%hash_table, [20,20],[qw(test requirement)]) ' test requirement -------------------- -------------------- L L L L L L L L L L ' QUALITY ASSURANCE Running the test script "Column.t" verifies the requirements for this module. The "tmake.pl" cover script for Test::STDmaker automatically generated the "Column.t" test script, "Column.d" demo script, and "t::Text::Column" program module POD, from the "t::Text::Column" program module contents. The "tmake.pl" cover script automatically ran the "Column.d" demo script and inserted the results into the 'DEMONSTRATION' section above. The "t::Text::Column" program module is in the distribution file Text-Column-$VERSION.tar.gz. NOTES Author The holder of the copyright and maintainer is Copyright Notice Copyrighted (c) 2002 Software Diamonds All Rights Reserved Binding Requirement Notice Binding requirements are indexed with the pharse 'shall[dd]' where dd is an unique number for each header section. This conforms to standard federal government practices, STD490A 3.2.3.6. In accordance with the License, Software Diamonds is not liable for any requirement, binding or otherwise. License Software Diamonds permits the redistribution and use in source and binary forms, with or without modification, provided that the following conditions are met: 1 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. SOFTWARE DIAMONDS, http::www.softwarediamonds.com, PROVIDES THIS SOFTWARE 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWARE DIAMONDS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING USE OF THIS SOFTWARE, EVEN IF ADVISED OF NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE POSSIBILITY OF SUCH DAMAGE. SEE ALSO Docs::Site_SVD::Text_Column Test::STDmaker ExtUtils::SVDmaker Title Page Software Version Description for Text::Column - Format tables from hashes and arrays suitable for PODs Revision: D Version: 0.05 Date: 2004/04/29 Prepared for: General Public Prepared by: SoftwareDiamonds.com Esupport@SoftwareDiamonds.comE Copyright: copyright © 2003 Software Diamonds Classification: NONE 1.0 SCOPE This paragraph identifies and provides an overview of the released files. 1.1 Identification This release, identified in 3.2, is a collection of Perl modules that extend the capabilities of the Perl language. 1.2 System overview The "Text::Column" module extends the Perl language (the system). The US DOD 2167A software development standard creates and cites a fully decent number of Data Item Descriptions (DID). A DID and US DOD 490A, Specification Practices, specify in great detail the paragraph number, headings and the information required for each paragraph in the document govern by the DID. The usually approach is for suppliers of the DIDs to set up templates and fill in the template with the missing information to complete the DID document. Different organizations use different degrees of automation. Some will have hard copy templates. Some will use word processor templates. Others will use Visual Basic to merge database information into a template. The methods in this module support a Perl automation of this processes. by formatting raw array and hash data into tables for inclusion in PODS 1.3 Document overview. This document releases Text::Column version 0.05 providing a description of the inventory, installation instructions and other information necessary to utilize and track this release. 3.0 VERSION DESCRIPTION All file specifications in this SVD use the Unix operating system file specification. 3.1 Inventory of materials released. This document releases the file Text-Column-0.05.tar.gz found at the following repository(s): http://www.softwarediamonds/packages/ http://www.perl.com/CPAN/authors/id/S/SO/SOFTDIA/ Restrictions regarding duplication and license provisions are as follows: Copyright. copyright © 2003 Software Diamonds Copyright holder contact. 603 882-0846 Esupport@SoftwareDiamonds.comE License. Software Diamonds permits the redistribution and use in source and binary forms, with or without modification, provided that the following conditions are met: 1 Redistributions of source code, modified or unmodified must retain the above copyright notice, this list of conditions and the following disclaimer. 2 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. SOFTWARE DIAMONDS, http://www.SoftwareDiamonds.com, PROVIDES THIS SOFTWARE 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWARE DIAMONDS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING USE OF THIS SOFTWARE, EVEN IF ADVISED OF NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE POSSIBILITY OF SUCH DAMAGE. 3.2 Inventory of software contents The content of the released, compressed, archieve file, consists of the following files: file version date comment ------------------------------------------------------------ ------- ---------- ------------------------ lib/Docs/Site_SVD/Text_Column.pm 0.05 2004/04/29 revised 0.04 MANIFEST 0.05 2004/04/29 generated, replaces 0.04 Makefile.PL 0.05 2004/04/29 generated, replaces 0.04 README 0.05 2004/04/29 generated, replaces 0.04 lib/Text/Column.pm 1.11 2004/04/29 revised 1.1 t/Text/Column.d 0.01 2003/07/27 unchanged t/Text/Column.pm 0.04 2004/04/29 revised 0.03 t/Text/Column.t 0.05 2003/09/15 unchanged t/Text/File/Package.pm 1.16 2004/04/29 new t/Text/Test/Tech.pm 1.21 2004/04/29 new t/Text/Data/Secs2.pm 1.18 2004/04/29 new t/Text/Data/SecsPack.pm 0.03 2004/04/29 new t/Text/Data/Startup.pm 0.03 2004/04/29 new 3.3 Changes The changes to the previous version are as follows: Test-STD-STDutil-0.01 Rename Module At 02:44 AM 6/14/2003 +0200, Max Maischein wrote: A second thing that I would like you to reconsider is the naming of "Test::TestUtil" respectively "Test::Tech" - neither of those is descriptive of what the routines actually do or what the module implements. I would recommend renaming them to something closer to your other modules, maybe "Test::SVDMaker::Util" and "Test::SVDMaker::Tech", as some routines do not seem to be specific to the Test::-suite but rather general (format_array_table). Some parts (the "scrub" routines) might even better live in another module namespace, "Test::Util::ScrubData" or something like that. Broke away the template and table routines from Test::TestUtil created this module Test::STD::STDutil. Test-STD-STDutil-0.02 Use the new modules from the break-up of the "File::FileUtil" module Text-Text-0.01 Broke up the "Test::STD::STDutil" module and moved it to more appropriate places in the high level directory tree. Text-Column-0.01 Changed name from Text::Table to Text::Column. Text::Table taken. Text-Column-0.02 Change the test so that test support program modules resides in distribution directory tlib directory instead of the lib directory. Because they are no longer in the lib directory, test support files will not be installed as a pre-condition for the test of this module. The test of this module will precede immediately. The test support files in the tlib directory will vanish after the installtion. Text-Column-0.03 Recreate distribution file with Archive::TarGzip 0.02 that uses mode 777 for directories instead of 666. Started to get emails from Unix installers about untar not being able to change to a directory with mode of 666. Text-Column-0.04 Add the module 'Data::Secs2' in the tlib that provides 'stringify' support for the 'Test::Tech' module. Text-Column-0.05 The lastest build of Test::STDmaker expects the test library in the same directory as the test script. Coordiated with the lastest Test::STDmaker by moving the test library from "tlib" to "t/Text", the same directory as the test script and deleting the test library File::TestPath program module. CPAN software does not expect "tlib" and does not properly process it. Minor clean-up on the POD. 3.4 Adaptation data. This installation requires that the installation site has the Perl programming language installed. There are no other additional requirements or tailoring needed of configurations files, adaptation data or other software needed for this installation particular to any installation site. 3.5 Related documents. There are no related documents needed for the installation and test of this release. 3.6 Installation instructions. Instructions for installation, installation tests and installation support are as follows: Installation Instructions. To installed the release file, use the CPAN module pr PPM module in the Perl release or the INSTALL.PL script at the following web site: http://packages.SoftwareDiamonds.com Follow the instructions for the the chosen installation software. If all else fails, the file may be manually installed. Enter one of the following repositories in a web browser: http://www.softwarediamonds/packages/ http://www.perl.com/CPAN/authors/id/S/SO/SOFTDIA/ Right click on 'Text-Column-0.05.tar.gz' and download to a temporary installation directory. Enter the following where $make is 'nmake' for microsoft windows; otherwise 'make'. gunzip Text-Column-0.05.tar.gz tar -xf Text-Column-0.05.tar perl Makefile.PL $make test $make install On Microsoft operating system, nmake, tar, and gunzip must be in the exeuction path. If tar and gunzip are not install, download and install unxutils from http://packages.softwarediamonds.com Prerequistes. None. Security, privacy, or safety precautions. None. Installation Tests. Most Perl installation software will run the following test script(s) as part of the installation: t/Text/Column.t Installation support. If there are installation problems or questions with the installation contact 603 882-0846 Esupport@SoftwareDiamonds.comE 3.7 Possible problems and known errors There is still much work needed to ensure the quality of this module as follows: * State the functional requirements for each method including not only the GO paths but also what to expect for the NOGO paths * All the tests are GO path tests. Should add NOGO tests. * Add the requirements addressed as *# R: * comment to the tests * Write a program to build a matrix to trace test step to the requirements and vice versa by parsing the *# R: * comments. Automatically insert the matrix in the Test::TestUtil POD. 4.0 NOTES The following are useful acronyms: .d extension for a Perl demo script file .pm extension for a Perl Library Module .t extension for a Perl test script file 2.0 SEE ALSO Text::Column Docs::US_DOD::SVD