diff -Nru libtext-table-perl-1.123/Build.PL libtext-table-perl-1.132/Build.PL --- libtext-table-perl-1.123/Build.PL 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/Build.PL 2016-11-28 18:49:45.000000000 +0000 @@ -1,47 +1,69 @@ + +# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.047. use strict; use warnings; -use lib './inc'; +use Module::Build 0.28; + + +my %module_build_args = ( + "build_requires" => { + "Module::Build" => "0.28" + }, + "configure_requires" => { + "ExtUtils::MakeMaker" => 0, + "Module::Build" => "0.28" + }, + "dist_abstract" => "Organize Data in Tables", + "dist_author" => [ + "Shlomi Fish " + ], + "dist_name" => "Text-Table", + "dist_version" => "1.132", + "license" => "open_source", + "module_name" => "Text::Table", + "recursive_test_files" => 1, + "requires" => { + "Carp" => 0, + "List::Util" => 0, + "Text::Aligner" => 0, + "overload" => 0, + "perl" => "5.008", + "strict" => 0, + "warnings" => 0 + }, + "test_requires" => { + "File::Spec" => 0, + "File::Temp" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Test::More" => 0, + "blib" => "1.01", + "constant" => 0, + "vars" => 0 + } +); -use Test::Run::Builder; -my $builder = Test::Run::Builder->new( - module_name => 'Text::Table', - license => 'bsd', - dist_author => 'Shlomi Fish ', - dist_version_from => 'lib/Text/Table.pm', - configure_requires => - { - 'Module::Build' => 0.36, - }, - build_requires => { - 'Test::More' => 0, - }, - requires => { - 'strict' => 0, - 'warnings' => 0, - 'Text::Aligner' => '0.05', - }, - add_to_cleanup => [ 'Text-Table-*' ], - create_makefile_pl => 'traditional', - meta_merge => - { - resources => - { - repository => "https://github.com/shlomif/Text-Table", - homepage => "http://www.shlomifish.org/open-source/projects/docmake/", - }, - keywords => - [ - "art", - "ascii", - "asciiart", - "borders", - "table", - "text", - "unicode", - ], - }, +my %fallback_build_requires = ( + "File::Spec" => 0, + "File::Temp" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Module::Build" => "0.28", + "Test::More" => 0, + "blib" => "1.01", + "constant" => 0, + "vars" => 0 ); -$builder->create_build_script(); + +unless ( eval { Module::Build->VERSION(0.4004) } ) { + delete $module_build_args{test_requires}; + $module_build_args{build_requires} = \%fallback_build_requires; +} + +my $build = Module::Build->new(%module_build_args); + + +$build->create_build_script; diff -Nru libtext-table-perl-1.123/Changes libtext-table-perl-1.132/Changes --- libtext-table-perl-1.123/Changes 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/Changes 2016-11-28 18:49:45.000000000 +0000 @@ -1,87 +1,131 @@ Revision history for Perl extension Text::Table. -1.123 ( Fri Jun 10 21:08:50 IDT 2011 ) -- Add ./Build to MANIFEST.SKIP so it won't be packaged. - - Thanks to Zed Pobre. - -1.122 ( Fri Jun 3 21:25:01 IDT 2011 ) -- Fix https://rt.cpan.org/Public/Bug/Display.html?id=68631 - passing -hashrefs as separators. -- Many refactorings. - -1.121 ( Thu May 26 21:22:21 IDT 2011 ) -- Convert t/10_Table.t to Test-Count. -- Refactored t/10_Table.t . -- Refactored lib/Text/Table.pm - -1.120 ( Sat May 14 09:52:08 IDT 2011 ) -- Convert the build system to Module::Build : - - Build.PL and inc/Test/Run/Builder.pm . -- Made the README more meaningful and concise (instead of a copy-and-paste -from the documentation.) -- Convert t/10_Table.t to Test::More. - -1.119 ( Sat May 14 07:33:25 IDT 2011 ) -- Fix the Copyright to say Anno first and Shlomi Fish later. - - thanks to Zed Pobre. - -1.118 -- Convert to the ISC license. - -1.117 Wed Apr 20 22:26:43 IDT 2011 -- add the callback ("sub { ... }")-based ->rule() method to render each -section in a rule differently. -- Add SHLOMIF as the maintainer. -- Add t/pod.t and t/pod-coverage.t . Documented $table->stringify() and -$table->table_height(). - -1.116 Sa 28 Aug 2010 22:00:56 CEST -- added color support - -1.115 Do 13 Mai 2010 15:50:46 CEST -- Bug when $/ is set to undef - -1.114 Sat Feb 16 13:52:19 CET 2008 -- Changed the documentation to reflect the possibility of multiline - data (by daotoad). - Sun May 11 13:37:44 CEST 2008 -- Fixed spurious warning with ->load([]) -- Released - -1.107 Tue Sep 21 20:47:07 CEST 2004 -- Added a feature where rows with embedded newlines are expanded - into following rows. (by Josh Jore) -- Added a feature where ->add and ->load return the table object - enabling chained method calls. (by Josh Jore) -- Added auto-initialisation. An unspecified table creates the - requisite number of title-less columns on first data entry. - -1.102 Fri Sep 12 20:59:34 CEST 2003 -- Added features align_title and align_title_lines -- fixed a bug with samples, which weren't honored in title alignment in - a table with no data -- planned for release 6 - -1.100 Fri Sep 12 17:34:40 CEST 2003 -- Version jump to make module version and cvs version equal (and compatible) - -0.05 Sun Feb 16 17:51:49 CET 2003 -- added method colrange (see bug id 2053) - -0.04 Sun Feb 9 17:14:36 CET 2003 -- see bug ids 2052, 2053 -- pod changed to reflect the implementation concerning rule() and - body_rule(). (It described rule() wrongly and listed non-existent - title_rule() instead of body_rule()) -- Added test for body_rule(). - -0.03 Sun Dec 29 18:03:57 CET 2002 -- another spurious warning from _parse_spec fixed, test added - -0.02 Tue Dec 3 23:53:54 CET 2002 -- minor bug fixes concerning spurious warnings -- released to CPAN Thu Dec 5 01:42:11 CET 2002 +1.132 2016-11-28 + - Fix a syntax error in the POD. + - https://rt.cpan.org/Ticket/Display.html?id=118852 + - Thanks to Rihards for the report. + - Convert to Dist-Zilla and Pod::Weaver + - See https://rt.cpan.org/Ticket/Display.html?id=118923 + - Thanks to coolo from OpenSUSE. + - In the process, change the license in the META files to ISC. + +1.131 2016-07-29 + - Merge pull-request from Zac Bentley to speed up boolean tests. + - https://github.com/shlomif/Text-Table/pull/4 + - Closes https://github.com/shlomif/Text-Table/issues/3 + +1.130 2014-04-12 + - Minimum perl version in 'requires' this time in META.yml (CPANTS). + - Change the META.yml license indicator to 'mit' - it is the ISC + license, which is MIT in effect. (CPANTS). + +1.129 2014-02-01 + - Add minimum perl version to META.yml (CPANTS). + +1.128 2013-10-25 + - Typo fixes thanks to David Steinbrunner. + - https://github.com/shlomif/Text-Table/pull/1 + +1.127 2013-05-21 + - Add t/style-trailing-space.t. + - Remove trailing space. + +1.126 2012-09-23 + - Fix handling of regular expression aligners. + - Thanks to Ilya for the report. + - Fixes https://rt.cpan.org/Ticket/Display.html?id=79803 + +1.125 2012-09-01 + - Add examples/Text-Table-UTF8-example.pl + - Thanks to Lady_Aleena for inspiring it. + +1.124 2011-09-02 + - Fix handling whitespace in column separators when the callback-based + rule is invoked. + - Thanks to Cary Millsap for the bug report. + +1.123 2011-06-10 + - Add ./Build to MANIFEST.SKIP so it won't be packaged. + - Thanks to Zed Pobre. + +1.122 2011-06-03 + - Fix https://rt.cpan.org/Public/Bug/Display.html?id=68631 - passing + hashrefs as separators. + - Many refactorings. + +1.121 2011-05-26 + - Convert t/10_Table.t to Test-Count. + - Refactored t/10_Table.t . + - Refactored lib/Text/Table.pm + +1.120 2011-05-14 + - Convert the build system to Module::Build : + - Build.PL and inc/Test/Run/Builder.pm . + - Made the README more meaningful and concise (instead of a copy-and-paste + from the documentation.) + - Convert t/10_Table.t to Test::More. + +1.119 2011-05-14 + - Fix the Copyright to say Anno first and Shlomi Fish later. + - thanks to Zed Pobre. + +1.118 2011-05-05 + - Convert to the ISC license. + + 1.117 2011-04-10 + - add the callback ("sub { ... }")-based ->rule() method to render each + section in a rule differently. + - Add SHLOMIF as the maintainer. + - Add t/pod.t and t/pod-coverage.t . Documented $table->stringify() and + $table->table_height(). + +1.116 2010-08-08 + - added color support + +1.115 2010-05-13 + - Bug when $/ is set to undef + +1.114 2008-02-16 + - Changed the documentation to reflect the possibility of multiline + data (by daotoad). + Sun May 11 13:37:44 CEST 2008 + - Fixed spurious warning with ->load([]) + - Released + +1.107 2004-09-21 + - Added a feature where rows with embedded newlines are expanded + into following rows. (by Josh Jore) + - Added a feature where ->add and ->load return the table object + enabling chained method calls. (by Josh Jore) + - Added auto-initialisation. An unspecified table creates the + requisite number of title-less columns on first data entry. + +1.102 2003-09-12 + - Added features align_title and align_title_lines + - fixed a bug with samples, which weren't honored in title alignment in + a table with no data + - planned for release 6 + +1.100 2003-09-12 + - Version jump to make module version and cvs version equal (and compatible) + +0.05 2003-02-16 + - added method colrange (see bug id 2053) + +0.04 2003-02-09 + - see bug ids 2052, 2053 + - pod changed to reflect the implementation concerning rule() and + body_rule(). (It described rule() wrongly and listed non-existent + title_rule() instead of body_rule()) + - Added test for body_rule(). + +0.03 2002-12-29 + - another spurious warning from _parse_spec fixed, test added + +0.02 2002-12-03 + - minor bug fixes concerning spurious warnings + - released to CPAN Thu Dec 5 01:42:11 CET 2002 -0.01 Tue Nov 19 17:47:02 2002 -- initial release to CPAN Tue Dec 3 07:59 +0.01 2002-11-19 + - initial release to CPAN Tue Dec 3 07:59 diff -Nru libtext-table-perl-1.123/debian/changelog libtext-table-perl-1.132/debian/changelog --- libtext-table-perl-1.123/debian/changelog 2016-12-31 06:26:18.000000000 +0000 +++ libtext-table-perl-1.132/debian/changelog 2016-12-31 06:26:19.000000000 +0000 @@ -1,3 +1,10 @@ +libtext-table-perl (1.132-1) unstable; urgency=low + + * New upstream version + * Standards-Version: 3.9.8 + + -- Zed Pobre Fri, 30 Dec 2016 12:49:21 -0500 + libtext-table-perl (1.123-1) unstable; urgency=low * New upstream version diff -Nru libtext-table-perl-1.123/debian/control libtext-table-perl-1.132/debian/control --- libtext-table-perl-1.123/debian/control 2016-12-31 06:26:18.000000000 +0000 +++ libtext-table-perl-1.132/debian/control 2016-12-31 06:26:19.000000000 +0000 @@ -2,13 +2,13 @@ Section: perl Priority: extra Maintainer: Zed Pobre -Build-Depends: debhelper (>= 7), libtext-aligner-perl (>= 0.01) -Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 7), libtext-aligner-perl (>= 0.05) +Standards-Version: 3.9.8 Homepage: http://search.cpan.org/perldoc?Text::Table Package: libtext-table-perl Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, libtext-aligner-perl (>= 0.01) +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, libtext-aligner-perl (>= 0.05) Description: Create tables that adapt to alignment requirements You create a Text::Table object by describing the columns the table is going to have. Then you load lines of data into the table, and diff -Nru libtext-table-perl-1.123/dist.ini libtext-table-perl-1.132/dist.ini --- libtext-table-perl-1.123/dist.ini 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/dist.ini 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,39 @@ +name = Text-Table +author = Shlomi Fish +license = ISC +copyright_holder = Anno Siegel and others +copyright_year = 2002 + +[@Filter] +-bundle = @Basic +-remove = License +-remove = Readme +[AutoPrereqs] +[Keywords] +keyword = art +keyword = ascii +keyword = asciiart +keyword = borders +keyword = table +keyword = text +keyword = unicode +[MetaProvides::Package] +[MetaResources] +bugtracker.web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Table +bugtracker.mailto = bug-text-table@rt.cpan.org +repository.url = ssh://git@github.com:shlomif/perl-Text-Table.git +repository.web = https://github.com/shlomif/perl-Text-Table +repository.type = git +[ModuleBuild] +[MetaJSON] +[PodSyntaxTests] +[PodCoverageTests] +[PodWeaver] +[PruneFiles] +match = ^rejects/ +[RewriteVersion] +[Test::Compile] +fake_home = 1 +skip = bump-ver|tag-release|run_agg_tests +[Test::CPAN::Changes] +[Test::Kwalitee::Extra] diff -Nru libtext-table-perl-1.123/examples/Text-Table-UTF8-example.pl libtext-table-perl-1.132/examples/Text-Table-UTF8-example.pl --- libtext-table-perl-1.123/examples/Text-Table-UTF8-example.pl 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/examples/Text-Table-UTF8-example.pl 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,116 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use utf8; + +use Text::Table; + +binmode STDOUT, ':utf8'; + +my @cols = qw/First Last Country/; +my $sep = \'│'; + +my $major_sep = \'║'; +my $tb = Text::Table->new($sep, " Number ", $major_sep, + (map { +(" $_ ", $sep) } @cols) +); + +my $num_cols = @cols; + +$tb->load([1, "Mark", "Twain", "USA",]); +$tb->load([2, "Charles", "Dickens", "Britain",]); +$tb->load([3, "Jules", "Verne", "France",]); + +my $make_rule = sub { + my ($args) = @_; + + my $left = $args->{left}; + my $right = $args->{right}; + my $main_left = $args->{main_left}; + my $middle = $args->{middle}; + + return $tb->rule( + sub { + my ($index, $len) = @_; + + return ('─' x $len); + }, + sub { + my ($index, $len) = @_; + + my $char = + ( ($index == 0) ? $left + : ($index == 1) ? $main_left + : ($index == $num_cols+1) ? $right + : $middle + ); + + return $char x $len; + }, + ); +}; + +my $start_rule = $make_rule->( + { + left => '┌', + main_left => '╥', + right => '┐', + middle => '┬', + } +); + +my $mid_rule = $make_rule->( + { + left => '├', + main_left => '╫', + right => '┤', + middle => '┼', + } +); + +my $end_rule = $make_rule->( + { + left => '└', + main_left => '╨', + right => '┘', + middle => '┴', + } +); + + +print $start_rule, $tb->title, + (map { $mid_rule, $_, } $tb->body()), $end_rule; + +__END__ + +=head1 COPYRIGHT & LICENSE + +Copyright 2012 by Shlomi Fish + +This program is distributed under the MIT (X11) License: +L + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +=cut diff -Nru libtext-table-perl-1.123/.gitignore libtext-table-perl-1.132/.gitignore --- libtext-table-perl-1.123/.gitignore 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -blib -_build -Build -Makefile -Makefile.PL -MANIFEST.bak -MYMETA.yml -pm_to_blib -Text-Table-* diff -Nru libtext-table-perl-1.123/inc/Test/Run/Builder.pm libtext-table-perl-1.132/inc/Test/Run/Builder.pm --- libtext-table-perl-1.123/inc/Test/Run/Builder.pm 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/inc/Test/Run/Builder.pm 2016-11-28 18:49:45.000000000 +0000 @@ -54,7 +54,7 @@ Test::Run::CmdLine::Iface->new( { 'test_files' => [glob("t/*.t")], - } + } # 'backend_params' => $self->_get_backend_params(), ); diff -Nru libtext-table-perl-1.123/lib/Text/Table.pm libtext-table-perl-1.132/lib/Text/Table.pm --- libtext-table-perl-1.123/lib/Text/Table.pm 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/lib/Text/Table.pm 2016-11-28 18:49:45.000000000 +0000 @@ -4,26 +4,30 @@ use strict; use warnings; +use 5.008; + use List::Util qw(sum max); use Text::Aligner qw(align); -BEGIN { - our $VERSION = '1.123'; -} +our $VERSION = '1.132'; -use overload - '""' => 'stringify', -; +use overload ( + # Don't stringify when only doing boolean tests, since stringification can + # be expensive for large tables: + bool => sub { return 1; }, + # Stringify when Table instances are used in most other scalar cases: + '""' => 'stringify', +); ### User interface: How to specify columns and column separators sub _is_sep { my $datum = shift; - return + return ( - defined($datum) + defined($datum) and ( (ref($datum) eq 'SCALAR') @@ -97,7 +101,7 @@ my $alispec = qr/^ *(?:left|center|right|num|point|auto)/; my ( $title, $align, $align_title, $align_title_lines, $sample); - if ( ref eq 'HASH' ) { + if ( ref ($spec) eq 'HASH' ) { ( $title, $align, $align_title, $align_title_lines, $sample) = @{$spec}{qw( title align align_title align_title_lines sample )}; } else { @@ -107,7 +111,13 @@ } else { $title = $spec; } - defined and chomp for $title, $sample; + for my $s ($title, $sample) + { + if (defined($s)) + { + chomp($s); + } + } } # Assign default values. @@ -126,13 +136,13 @@ _default_if_empty(\$align, 'auto'); unless ( - ref $align eq 'Regex' or + ref $align eq 'Regexp' or $align =~ /^(?:left|center|right|num\(?|point\(?|auto)/ ) { _warn( "Invalid align specification: '$align', using 'auto'"); $align = 'auto'; } - + _default_if_empty(\$align_title, 'left'); if ( ! _is_align($align_title) ) { @@ -141,7 +151,7 @@ ); $align_title = 'left'; } - + _default_if_empty(\$align_title_lines, $align_title); if ( ! _is_align($align_title_lines) ) { @@ -167,7 +177,7 @@ { my $tb = bless {}, shift; - return $tb->_entitle( @_); + return $tb->_entitle( [ @_ ] ); } sub _blank @@ -243,17 +253,17 @@ } sub _entitle { - my $tb = shift; # will be completely overwritten + my ($tb, $sep_list) = @_; # will be completely overwritten # find active separators and, well separate them from col specs. # n+1 separators for n cols my ( @seps, @spec); # separators and column specifications my $sep; - for ( @_ ) { - if ( _is_sep ( $_) ) { - $sep = _parse_sep( $_); + foreach my $sep_item ( @{$sep_list} ) { + if ( _is_sep ($sep_item) ) { + $sep = _parse_sep($sep_item); } else { push @seps, $sep; - push @spec, _parse_spec( $_); + push @spec, _parse_spec($sep_item); undef $sep; } } @@ -312,7 +322,7 @@ my ($field, $seps) = @_; return _compile_format( - [map { defined($_) ? $_->{$field} : undef } @$seps] + [map { defined($_) ? $_->{$field} : undef } @$seps] ); } @@ -320,7 +330,10 @@ sub _recover_separators { my $format = shift; my @seps = split /(?_check_index( $_); - return @$group if grep $_, @{ $tb->_cols->[ $_]}; + return $group unless ref $group eq 'ARRAY'; + GROUP_LOOP: + for my $g ( @$group ) { + if (_is_sep($g)) + { + next GROUP_LOOP; + } + $tb->_check_index($g); + + if (grep { $_} @{ $tb->_cols->[$g] }) + { + return @$group; + } return; # no more tries after non-sep was found } return; # no column index in group, no select @@ -375,9 +396,9 @@ ### data entry -sub _clear_cache { +sub _clear_cache { my ($tb) = @_; - + $tb->_blank(undef()); $tb->_lines(undef()); @@ -387,24 +408,33 @@ # add one data line or split the line into follow-up lines sub add { my $tb = shift; - $tb->_entitle( ( '') x @_) unless $tb->n_cols; - $tb->_add( @$_) for - _transpose( + if (! $tb->n_cols) { + $tb->_entitle( [ ('') x @_] ); + } + + foreach my $row ( + _transpose( [ map { [ defined() ? split( /\n/ ) : '' ] } @_ ] - ); + ) + ) + { + $tb->_add(@$row); + } $tb->_clear_cache; return $tb; -} +} # add one data line sub _add { my $tb = shift; - push @$_, shift for @{ $tb->_cols}; + foreach my $col ( @{ $tb->_cols} ) { + push @{$col}, shift(@_); + } $tb->_clear_cache; @@ -414,9 +444,13 @@ # add one or more data lines sub load { my $tb = shift; - for ( @_ ) { - defined $_ or $_ = ''; - ref eq 'ARRAY' ? $tb->add( @$_) : $tb->add( split); + foreach my $row ( @_ ) { + if (!defined($row)) { + $row = ''; + } + $tb->add( + (ref($row) eq 'ARRAY') ? (@$row) : (split ' ',$row) + ) } $tb; } @@ -424,7 +458,10 @@ sub clear { my $tb = shift; - $_ = [] for @{ $tb->_cols}; + foreach my $col (@{ $tb->_cols} ) + { + $col = []; + } $tb->_clear_cache; @@ -435,7 +472,7 @@ ## sizes -# number of table clolumns +# number of table columns sub n_cols { scalar @{ $_[0]->{ spec}} } # number of title lines @@ -443,7 +480,7 @@ # number of data lines sub body_height -{ +{ my ($tb) = @_; return ($tb->n_cols && scalar @{ $tb->_cols->[0] }); @@ -451,7 +488,7 @@ # total height sub table_height -{ +{ my $tb = shift; return $tb->title_height + $tb->body_height; } @@ -466,11 +503,9 @@ return $tb->height && (length( ($tb->table(0))[0] ) - 1); } -# start and width of each column -sub colrange { - my ( $tb, $col_index) = @_; - - return ( 0, 0) unless $tb->width; # width called, $tb->_blank() exists now +sub _normalize_col_index +{ + my ($tb, $col_index) = @_; $col_index ||= 0; @@ -488,6 +523,16 @@ $col_index = $tb->n_cols; } + return $col_index; +} + +# start and width of each column +sub colrange { + my ( $tb, $proto_col_index) = @_; + + my $col_index = $tb->_normalize_col_index($proto_col_index); + + return ( 0, 0) unless $tb->width; # width called, $tb->_blank() exists now my @widths = map { length } @{ $tb->_blank}, ''; @widths = @widths[ 0 .. $col_index]; @@ -519,7 +564,7 @@ my $tb = shift; return $tb->_table_portion( $tb->title_height, 0, @_); -} +} # only body sub body { @@ -529,7 +574,7 @@ } sub stringify -{ +{ my ($tb) = @_; return (scalar ( $tb->table() )); @@ -560,7 +605,7 @@ return [ - map $tb->_assemble_line( $_ >= $limit, $tb->_table_line( $_)), + map $tb->_assemble_line( $_ >= $limit, $tb->_table_line( $_), 0), $from .. $from + $n - 1 ]; } @@ -663,7 +708,7 @@ return _transpose_n( $tb->height, \@cols); # bye-bye, @cols } -# destructively transpose a number of lines/cols from an array of arrayrefs +# destructively transpose a number of lines/cols from an array of arrayrefs sub _transpose_n { my ($n, $cols) = @_; @@ -682,9 +727,16 @@ # make a line from a number of formatted data elements sub _assemble_line { - my ($tb, $in_body, $line_aref) = @_; + my ($tb, $in_body, $line_aref, $replace_spaces) = @_; + + my $format = $tb->_forms->[ !!$in_body]; - return sprintf( $tb->_forms->[ !!$in_body], @$line_aref) . "\n"; + if ($replace_spaces) + { + $format =~ s/\s/=/g; + } + + return sprintf($format, @$line_aref) . "\n"; } sub _text_rule @@ -716,7 +768,9 @@ { my ($tb, $in_body, $char, $alt) = @_; - my $rule = $tb->_assemble_line( $in_body, $tb->_blank); + my $rule = $tb->_assemble_line( $in_body, $tb->_blank, + ((ref($char) eq "CODE") ? 1 : 0), + ); return $tb->_render_rule($rule, $char, $alt); } @@ -830,13 +884,18 @@ } } -__END__ -########################################### main pod documentation begin ## +=pod + +=encoding UTF-8 =head1 NAME Text::Table - Organize Data in Tables +=head1 VERSION + +version 1.132 + =head1 SYNOPSIS use Text::Table; @@ -854,11 +913,11 @@ This prints a table from the given title and data like this: Planet Radius Density - km g/cm^3 - Mercury 2360 3.7 - Venus 6110 5.1 - Earth 6378 5.52 - Jupiter 71030 1.3 + km g/cm^3 + Mercury 2360 3.7 + Venus 6110 5.1 + Earth 6378 5.52 + Jupiter 71030 1.3 Note that two-line titles work, and that the planet names are aligned differently than the numbers. @@ -885,7 +944,7 @@ In the simplest case, if all you want is a number of (untitled) columns, you create an unspecified table and start adding data to it. The number -of columns is taken fronm the first line of data. +of columns is taken from the first line of data. To specify a table you specify its columns. A column description can contain a title and alignment requirements for the data, both @@ -983,7 +1042,7 @@ A column is given as a column title (any number of lines), optionally followed by alignment requirements. Alignment requirements -start with a line that begins with an ampersamd "&". However, only the +start with a line that begins with an ampersand "&". However, only the last such line counts as such, so if you have title lines that begin with "&", just append an ampersand on a line by itself as a dummy alignment section if you don't have one anyway. @@ -1016,7 +1075,7 @@ be given as a string or as an array-ref to the list of lines. $align contains the alignment style (without a leading ampersand), usually as a string. You can also give a regular expression here, which specifies regex alignment. -A regex can only be specified in the hash form of a colunm specification. +A regex can only be specified in the hash form of a column specification. In hash form you can also specify how the title of a column is aligned with its body. To do this, you specify the keyword C with @@ -1093,7 +1152,7 @@ Data items that look like numbers, and those that don't, form two virtual columns and are aligned accordingly: C for numbers and C for other strings. These columns are left-aligned with -each other (i.e. the narrower one is blank-filled) to form the +each other (i.e. the narrower one is blank-filled) to form the final alignment. This way, a column that happens to have only numbers in the data gets @@ -1242,7 +1301,7 @@ Data entries can be multi-line strings. The partial strings all go into the same column. The corresponding fields of other columns remain empty unless there is another multi-line entry in that column that fills the -fieds. Adding a line with multi-line entries is equivalent to adding +fields. Adding a line with multi-line entries is equivalent to adding multiple lines. Every call to C increases the body height of the table by the @@ -1324,7 +1383,7 @@ $tb->rule; $tb->rule( $char); $tb->rule( $char, $char1); - $tb->rule( sub { my ($index, $len) = @_; }, + $tb->rule( sub { my ($index, $len) = @_; }, sub { my ($index, $len) = @_; }, ); @@ -1339,7 +1398,7 @@ in the first form, but non-blank column separators are retained. If a second character is specified, it replaces the non-blank parts of the separators. So specifying the same character twice gives a solid -line of table width. Another useful combo is C<$tb-Erule( '-', '+')>, +line of table width. Another useful combo is C<$tb-Erule( '-', '+')>, together with separators that contain a single nonblank "|", for a popular representation of line crossings. @@ -1379,8 +1438,8 @@ =back =head1 VERSION - -This document pertains to Text::Table version 1.121 + +This document pertains to Text::Table version 1.127 =head1 BUGS @@ -1403,7 +1462,7 @@ =head2 ORIGINAL AUTHOR Anno Siegel - CPAN ID: ANNO + CPAN ID: ANNO siegel@zrz.tu-berlin.de http://www.tu-berlin.de/~siegel @@ -1424,6 +1483,147 @@ L, L . +=head1 AUTHOR + +Shlomi Fish + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2002 by Anno Siegel and others. + +This is free software, licensed under: + + The ISC License + +=head1 BUGS + +Please report any bugs or feature requests on the bugtracker website +http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Table or by email to +bug-text-table@rt.cpan.org. + +When submitting a bug or request, please include a test-file or a +patch to an existing test-file that illustrates the bug or desired +feature. + +=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan + +=head1 SUPPORT + +=head2 Perldoc + +You can find documentation for this module with the perldoc command. + + perldoc Text::Table + +=head2 Websites + +The following websites have more information about this module, and may be of help to you. As always, +in addition to those websites please use your favorite search engine to discover more resources. + +=over 4 + +=item * + +MetaCPAN + +A modern, open-source CPAN search engine, useful to view POD in HTML format. + +L + +=item * + +Search CPAN + +The default CPAN search engine, useful to view POD in HTML format. + +L + +=item * + +RT: CPAN's Bug Tracker + +The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. + +L + +=item * + +AnnoCPAN + +The AnnoCPAN is a website that allows community annotations of Perl module documentation. + +L + +=item * + +CPAN Ratings + +The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. + +L + +=item * + +CPAN Forum + +The CPAN Forum is a web forum for discussing Perl modules. + +L + +=item * + +CPANTS + +The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. + +L + +=item * + +CPAN Testers + +The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. + +L + +=item * + +CPAN Testers Matrix + +The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. + +L + +=item * + +CPAN Testers Dependencies + +The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. + +L + +=back + +=head2 Bugs / Feature Requests + +Please report any bugs or feature requests by email to C, or through +the web interface at L. You will be automatically notified of any +progress on the request by the system. + +=head2 Source Code + +The code is open to the world, and available for you to hack on. Please feel free to browse it and play +with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull +from your repository :) + +L + + git clone ssh://git@github.com:shlomif/perl-Text-Table.git + =cut +__END__ +########################################### main pod documentation begin ## + + 1; diff -Nru libtext-table-perl-1.123/Makefile.PL libtext-table-perl-1.132/Makefile.PL --- libtext-table-perl-1.123/Makefile.PL 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/Makefile.PL 2016-11-28 18:49:45.000000000 +0000 @@ -1,17 +1,76 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.36_17 +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.047. +use strict; +use warnings; + +use 5.008; + use ExtUtils::MakeMaker; -WriteMakefile -( - 'NAME' => 'Text::Table', - 'VERSION_FROM' => 'lib/Text/Table.pm', - 'PREREQ_PM' => { - 'Test::More' => 0, - 'Text::Aligner' => '0.05', - 'strict' => 0, - 'warnings' => 0 - }, - 'INSTALLDIRS' => 'site', - 'EXE_FILES' => [], - 'PL_FILES' => {} - ) -; + +my %WriteMakefileArgs = ( + "ABSTRACT" => "Organize Data in Tables", + "AUTHOR" => "Shlomi Fish ", + "BUILD_REQUIRES" => { + "Module::Build" => "0.28" + }, + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0, + "Module::Build" => "0.28" + }, + "DISTNAME" => "Text-Table", + "LICENSE" => "open_source", + "MIN_PERL_VERSION" => "5.008", + "NAME" => "Text::Table", + "PREREQ_PM" => { + "Carp" => 0, + "List::Util" => 0, + "Text::Aligner" => 0, + "overload" => 0, + "strict" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "File::Spec" => 0, + "File::Temp" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Test::More" => 0, + "blib" => "1.01", + "constant" => 0, + "vars" => 0 + }, + "VERSION" => "1.132", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "Carp" => 0, + "File::Spec" => 0, + "File::Temp" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "List::Util" => 0, + "Module::Build" => "0.28", + "Test::More" => 0, + "Text::Aligner" => 0, + "blib" => "1.01", + "constant" => 0, + "overload" => 0, + "strict" => 0, + "vars" => 0, + "warnings" => 0 +); + + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; +} + +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; + +WriteMakefile(%WriteMakefileArgs); diff -Nru libtext-table-perl-1.123/MANIFEST libtext-table-perl-1.132/MANIFEST --- libtext-table-perl-1.123/MANIFEST 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/MANIFEST 2016-11-28 18:49:45.000000000 +0000 @@ -1,17 +1,27 @@ -.gitignore +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.047. Build.PL Changes -inc/Test/Run/Builder.pm -lib/Text/Table.pm LICENSE -Makefile.PL MANIFEST MANIFEST.SKIP +META.json META.yml +Makefile.PL README +dist.ini +examples/Text-Table-UTF8-example.pl +inc/Test/Run/Builder.pm +lib/Text/Table.pm +t/00-compile.t t/01_ini.t t/10_Table.t t/11_Variable_Rule.t t/12_column_seps_as_hashes.t -t/pod-coverage.t -t/pod.t +t/13_callback_rules_with_whitespace.t +t/14_overload.t +t/author-pod-coverage.t +t/author-pod-syntax.t +t/release-cpan-changes.t +t/release-kwalitee.t +t/style-trailing-space.t +weaver.ini diff -Nru libtext-table-perl-1.123/MANIFEST.SKIP libtext-table-perl-1.132/MANIFEST.SKIP --- libtext-table-perl-1.123/MANIFEST.SKIP 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/MANIFEST.SKIP 2016-11-28 18:49:45.000000000 +0000 @@ -23,3 +23,4 @@ ^MYMETA.yml$ ^_build/ ^Build$ +^MYMETA\.json$ diff -Nru libtext-table-perl-1.123/META.json libtext-table-perl-1.132/META.json --- libtext-table-perl-1.123/META.json 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/META.json 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,89 @@ +{ + "abstract" : "Organize Data in Tables", + "author" : [ + "Shlomi Fish " + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 5.047, CPAN::Meta::Converter version 2.150005", + "keywords" : [ + "art", + "ascii", + "asciiart", + "borders", + "table", + "text", + "unicode" + ], + "license" : [ + "open_source" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "Text-Table", + "prereqs" : { + "build" : { + "requires" : { + "Module::Build" : "0.28" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0", + "Module::Build" : "0.28" + } + }, + "develop" : { + "requires" : { + "Pod::Coverage::TrustPod" : "0", + "Test::CPAN::Changes" : "0.19", + "Test::Pod" : "1.41", + "Test::Pod::Coverage" : "1.08" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "List::Util" : "0", + "Text::Aligner" : "0", + "overload" : "0", + "perl" : "5.008", + "strict" : "0", + "warnings" : "0" + } + }, + "test" : { + "requires" : { + "File::Spec" : "0", + "File::Temp" : "0", + "IO::Handle" : "0", + "IPC::Open3" : "0", + "Test::More" : "0", + "blib" : "1.01", + "constant" : "0", + "vars" : "0" + } + } + }, + "provides" : { + "Text::Table" : { + "file" : "lib/Text/Table.pm", + "version" : "1.132" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "mailto" : "bug-text-table@rt.cpan.org", + "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Table" + }, + "repository" : { + "type" : "git", + "url" : "ssh://git@github.com:shlomif/perl-Text-Table.git", + "web" : "https://github.com/shlomif/perl-Text-Table" + } + }, + "version" : "1.132" +} + diff -Nru libtext-table-perl-1.123/META.yml libtext-table-perl-1.132/META.yml --- libtext-table-perl-1.123/META.yml 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/META.yml 2016-11-28 18:49:45.000000000 +0000 @@ -3,10 +3,20 @@ author: - 'Shlomi Fish ' build_requires: - Test::More: 0 + File::Spec: '0' + File::Temp: '0' + IO::Handle: '0' + IPC::Open3: '0' + Module::Build: '0.28' + Test::More: '0' + blib: '1.01' + constant: '0' + vars: '0' configure_requires: - Module::Build: 0.36 -generated_by: 'Module::Build version 0.3617' + ExtUtils::MakeMaker: '0' + Module::Build: '0.28' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 5.047, CPAN::Meta::Converter version 2.150005' keywords: - art - ascii @@ -15,21 +25,24 @@ - table - text - unicode -license: bsd +license: open_source meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: Text-Table provides: Text::Table: file: lib/Text/Table.pm - version: 1.123 + version: '1.132' requires: - Text::Aligner: 0.05 - strict: 0 - warnings: 0 + Carp: '0' + List::Util: '0' + Text::Aligner: '0' + overload: '0' + perl: '5.008' + strict: '0' + warnings: '0' resources: - homepage: http://www.shlomifish.org/open-source/projects/docmake/ - license: http://www.opensource.org/licenses/bsd-license.php - repository: https://github.com/shlomif/Text-Table -version: 1.123 + bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Table + repository: ssh://git@github.com:shlomif/perl-Text-Table.git +version: '1.132' diff -Nru libtext-table-perl-1.123/README libtext-table-perl-1.132/README --- libtext-table-perl-1.123/README 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/README 2016-11-28 18:49:45.000000000 +0000 @@ -22,15 +22,12 @@ You can also look for information at: - Search CPAN - http://search.cpan.org/dist/Text-Table/ + MetaCPAN + http://metacpan.org/release/Text-Table CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text::Table - AnnoCPAN, annotated CPAN documentation: - http://annocpan.org/dist/Text::Table - CPAN Ratings: http://cpanratings.perl.org/d/Text::Table diff -Nru libtext-table-perl-1.123/t/00-compile.t libtext-table-perl-1.132/t/00-compile.t --- libtext-table-perl-1.123/t/00-compile.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/00-compile.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,57 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 + +use Test::More; + +plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); + +my @module_files = ( + 'Text/Table.pm' +); + + + +# fake home for cpan-testers +use File::Temp; +local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); + + +my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; + +use File::Spec; +use IPC::Open3; +use IO::Handle; + +open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; + +my @warnings; +for my $lib (@module_files) +{ + # see L + my $stderr = IO::Handle->new; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + binmode $stderr, ':crlf' if $^O eq 'MSWin32'; + my @_warnings = <$stderr>; + waitpid($pid, 0); + is($?, 0, "$lib loaded ok"); + + shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ + and not eval { require blib; blib->VERSION('1.01') }; + + if (@_warnings) + { + warn @_warnings; + push @warnings, @_warnings; + } +} + + + +is(scalar(@warnings), 0, 'no warnings found') + or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; + + diff -Nru libtext-table-perl-1.123/t/01_ini.t libtext-table-perl-1.132/t/01_ini.t --- libtext-table-perl-1.123/t/01_ini.t 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/t/01_ini.t 2016-11-28 18:49:45.000000000 +0000 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 1; # TEST use_ok('Text::Table'); diff -Nru libtext-table-perl-1.123/t/10_Table.t libtext-table-perl-1.132/t/10_Table.t --- libtext-table-perl-1.123/t/10_Table.t 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/t/10_Table.t 2016-11-28 18:49:45.000000000 +0000 @@ -1,7 +1,7 @@ -use strict; +use strict; use warnings; -use Test::More tests => 165; +use Test::More tests => 166; use Text::Table; @@ -256,7 +256,7 @@ } # overall functional check with typical table -use constant TYP_TITLE => +use constant TYP_TITLE => { title => 'name', align => 'left'}, { title => 'age'}, "salary\n in \$", @@ -268,15 +268,22 @@ [ qw( scroogy 87 356.10)], "frosty 16 9999.9", ; -use constant TYP_TITLE_ANS => <<'EOT'; + +BEGIN +{ + use vars qw($WS); + $WS = ' '; +}; + +use constant TYP_TITLE_ANS => <<"EOT"; name age salary gibsnich - in $ + in \$${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS} EOT -use constant TYP_BODY_ANS => <<'EOT'; -fred 28 1256 -mary_anne 34 445.02 -scroogy 87 356.10 -frosty 16 9999.9 +use constant TYP_BODY_ANS => <<"EOT"; +fred 28 1256${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS} +mary_anne 34 445.02${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS} +scroogy 87 356.10${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS} +frosty 16 9999.9${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS}${WS} EOT use constant TYP_ANS => TYP_TITLE_ANS . TYP_BODY_ANS; @@ -431,10 +438,10 @@ my ($args, $blurb) = @_; my $tb = Text::Table->new( - { - title => 'x', + { + title => 'x', (exists($args->{align_title}) - ? (align_title => $args->{align_title},) + ? (align_title => $args->{align_title},) : () ), }); @@ -467,10 +474,10 @@ my ($args, $blurb) = @_; my $tb = Text::Table->new( - { - title => "x\nxxx", + { + title => "x\nxxx", (exists($args->{align_title}) - ? (align_title_lines => $args->{align_title},) + ? (align_title_lines => $args->{align_title},) : () ), }); @@ -560,13 +567,13 @@ [ "m", "n", "o" ] ); # TEST - is( "$tb", <<'EOT', "Table after spaces"); + is( "$tb", <<"EOT", "Table after spaces"); A B C 1 2 3 a c d -b +b${WS}${WS}${WS}${WS} e f h - g + g${WS}${WS} i j k l m n o @@ -587,3 +594,9 @@ -> new( "x" x 10 ) -> add( "y" x 10 ), "x" x 10 . "\n" . "y" x 10 . "\n", "All in one - 2"); + +# TEST +is ( "" . Text::Table->new({align => qr/!/})->load(["aa!"],["a!a"],["!aa"]), + "aa! \n a!a \n !aa\n", + "align with a regular expression - RT #79803", +); diff -Nru libtext-table-perl-1.123/t/11_Variable_Rule.t libtext-table-perl-1.132/t/11_Variable_Rule.t --- libtext-table-perl-1.123/t/11_Variable_Rule.t 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/t/11_Variable_Rule.t 2016-11-28 18:49:45.000000000 +0000 @@ -13,12 +13,12 @@ sub { my ($i, $len) = @_; - return (($i == 0) ? ("X" x $len) : ($i == 2) ? ("Y" x $len) : + return (($i == 0) ? ("X" x $len) : ($i == 2) ? ("Y" x $len) : ("A" x $len)) ; }, - sub { - my ($i, $len) = @_; + sub { + my ($i, $len) = @_; return (($i == 0) ? "|=" : ($i == 3) ? "=|" : "+"); }, ), diff -Nru libtext-table-perl-1.123/t/13_callback_rules_with_whitespace.t libtext-table-perl-1.132/t/13_callback_rules_with_whitespace.t --- libtext-table-perl-1.123/t/13_callback_rules_with_whitespace.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/13_callback_rules_with_whitespace.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,84 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 1; +use List::Util qw(sum); +use Text::Table; + +# Standard Perl Cookbook function. +sub commify { + my $text = reverse $_[0]; + $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; + return scalar reverse $text; +} + +my $colsep = " "; # Use no-pixel column separators. + +# Make up some data. +my @names = ("some stuff that's kind of long", "short", "weird negative thing", "the last thing"); +my @dur = (123456, 1234.567890, -123456, 123.456); +my @calls = (4082, 477, 91, 45); +my $sumdur = sum(@dur); +my $N = scalar(@names); + +# Define table columns, and load the table header. +my %sep = ( is_sep => 1, title => $colsep, body => $colsep ); +my $tb = Text::Table->new( + { title => "FIRST", align_title => "left", align => "left" }, \%sep, + { title => "SECOND", align_title => "right", align => "num" }, \%sep, + { title => "%", align_title => "right", align => "num" }, \%sep, + { title => "FOUR", align_title => "right", align => "num", sample => "123,456,789" }, +); + +# Load the table body. +for (0 .. $N - 1) { + $tb->load([ + $names[$_], + commify((sprintf "%.6f", $dur[$_])), + sprintf("%.1f%%", $dur[$_]/$sumdur * 100), + commify($calls[$_]), + ]); +} + +# Load the table footer. +$tb->load([ + "TOTAL ($N)", + commify(sprintf "%.6f", $sumdur), + sprintf("%.1f%%", 100), + commify(sum(@calls)), +]); + +# Print the table. +my $rule = $tb->rule( + sub { + my ($i, $l) = @_; + # printf "\n1: i=%d l=%d\n", $i, $l; + return "-" x $l; + }, + sub { + my ($i, $l) = @_; + # printf "\n2: i=%d l=%d\n", $i, $l; + return " " x $l; + } +); + +my $output = +$tb->title . +$rule . +join('', map { $tb->body($_) } (0 .. $N-1)) . +$rule . +$tb->body($N); + +# TEST +is($output, <<'EOF', 'Spaces are handled correctly in rules.'); +FIRST SECOND % FOUR +------------------------------ --------------- -------- ----------- +some stuff that's kind of long 123,456.000000 9090.9% 4,082 +short 1,234.567890 90.9% 477 +weird negative thing -123,456.000000 -9090.9% 91 +the last thing 123.456000 9.1% 45 +------------------------------ --------------- -------- ----------- +TOTAL (4) 1,358.023890 100.0% 4,695 +EOF diff -Nru libtext-table-perl-1.123/t/14_overload.t libtext-table-perl-1.132/t/14_overload.t --- libtext-table-perl-1.123/t/14_overload.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/14_overload.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,27 @@ +use strict; +use warnings; +no warnings "redefine"; + +use Test::More tests => 4; + +use Text::Table; + +my %res; +local *Text::Table::stringify = sub { return $res{called} = "1"; }; +my $table = Text::Table->new; + +$table->add(1,1); +# TEST +ok(! delete $res{called}, "add in void context doesn't stringify()"); + +$table->load([1,1]); +# TEST +ok(! delete $res{called}, "load in void context doesn't stringify()"); + +if ( $table ) {} +# TEST +ok(! delete $res{called}, "use as a boolean doesn't stringify()"); + +my $var = "$table"; +# TEST +ok(delete $res{called}, "use as a string calls stringify()"); \ No newline at end of file diff -Nru libtext-table-perl-1.123/t/author-pod-coverage.t libtext-table-perl-1.132/t/author-pod-coverage.t --- libtext-table-perl-1.123/t/author-pod-coverage.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/author-pod-coverage.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,15 @@ +#!perl + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for testing by the author'); + } +} + +# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. + +use Test::Pod::Coverage 1.08; +use Pod::Coverage::TrustPod; + +all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff -Nru libtext-table-perl-1.123/t/author-pod-syntax.t libtext-table-perl-1.132/t/author-pod-syntax.t --- libtext-table-perl-1.123/t/author-pod-syntax.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/author-pod-syntax.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,15 @@ +#!perl + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for testing by the author'); + } +} + +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use strict; use warnings; +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); diff -Nru libtext-table-perl-1.123/t/pod-coverage.t libtext-table-perl-1.132/t/pod-coverage.t --- libtext-table-perl-1.123/t/pod-coverage.t 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/t/pod-coverage.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -#!perl -T - -use Test::More; -eval "use Test::Pod::Coverage 1.04"; -plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; -all_pod_coverage_ok(); diff -Nru libtext-table-perl-1.123/t/pod.t libtext-table-perl-1.132/t/pod.t --- libtext-table-perl-1.123/t/pod.t 2011-06-10 18:11:21.000000000 +0000 +++ libtext-table-perl-1.132/t/pod.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -BEGIN { - if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); - } - else { - unshift @INC, 't/lib'; - } -} - -use Test::More; -eval "use Test::Pod 1.00"; -plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; -all_pod_files_ok(); diff -Nru libtext-table-perl-1.123/t/release-cpan-changes.t libtext-table-perl-1.132/t/release-cpan-changes.t --- libtext-table-perl-1.123/t/release-cpan-changes.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/release-cpan-changes.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,19 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + + +use strict; +use warnings; + +use Test::More 0.96 tests => 2; +use_ok('Test::CPAN::Changes'); +subtest 'changes_ok' => sub { + changes_file_ok('Changes'); +}; +done_testing(); diff -Nru libtext-table-perl-1.123/t/release-kwalitee.t libtext-table-perl-1.132/t/release-kwalitee.t --- libtext-table-perl-1.123/t/release-kwalitee.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/release-kwalitee.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,19 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + + +# This test is generated by Dist::Zilla::Plugin::Test::Kwalitee::Extra +use strict; +use warnings; +use Test::More; # needed to provide plan. + +eval { require Test::Kwalitee::Extra }; +plan skip_all => "Test::Kwalitee::Extra required for testing kwalitee: $@" if $@; + +eval "use Test::Kwalitee::Extra"; diff -Nru libtext-table-perl-1.123/t/style-trailing-space.t libtext-table-perl-1.132/t/style-trailing-space.t --- libtext-table-perl-1.123/t/style-trailing-space.t 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/t/style-trailing-space.t 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +eval "use Test::TrailingSpace"; +if ($@) +{ + plan skip_all => "Test::TrailingSpace required for trailing space test."; +} +else +{ + plan tests => 1; +} + +my $finder = Test::TrailingSpace->new( + { + root => '.', + filename_regex => qr/(?:(?:\.(?:t|pm|pl|PL|yml|json|arc|vim))|README|Changes|LICENSE|MANIFEST)\z/, + }, +); + +# TEST +$finder->no_trailing_space( + "No trailing space was found." +); + diff -Nru libtext-table-perl-1.123/weaver.ini libtext-table-perl-1.132/weaver.ini --- libtext-table-perl-1.123/weaver.ini 1970-01-01 00:00:00.000000000 +0000 +++ libtext-table-perl-1.132/weaver.ini 2016-11-28 18:49:45.000000000 +0000 @@ -0,0 +1,39 @@ +[@CorePrep] + +[-SingleEncoding] + +[Generic / NAME] + +[Version] + +[Region / prelude] + + +[Generic / SYNOPSIS] +[Generic / DESCRIPTION] +[Generic / OVERVIEW] + +[Collect / ATTRIBUTES] +command = attr + +[Collect / METHODS] +command = method + +[Leftovers] + +[Region / postlude] + +[Authors] +[Legal] + +; [Generic / DESCRIPTION] +; required = 1 + +; [Generic / BUGS] + +; [Generic / Section::Bugs] +; [Generic / Section::License] +; +[Bugs] +[Support] +all_modules = 1