Author: cweyl Update of /cvs/extras/rpms/perl-Text-SimpleTable/devel In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31662 Modified Files: .cvsignore perl-Text-SimpleTable.spec sources Added Files: simpletable.patch Log Message: * Sun Sep 07 2008 Chris Weyl <cweyl@xxxxxxxxxxxxxxx> 0.05-1 - update to 0.05 - add patch from CPAN RT#22371 - change to ExtUtils::MakeMaker incantations simpletable.patch: --- NEW FILE simpletable.patch --- === Changes ================================================================== --- Changes (revision 13598) +++ Changes (local) @@ -1,5 +1,8 @@ Tis file documents the revision history for Perl extension Text::SimpleTable. +0.04 2006-10-19 + - Added horizontal rule (hr) method + 0.03 2006-01-17 22:00:00 - Fixed bug where text items of '0' were not displayed. === lib/Text/SimpleTable.pm ================================================================== --- lib/Text/SimpleTable.pm (revision 13598) +++ lib/Text/SimpleTable.pm (local) @@ -96,6 +96,17 @@ return $self; } +=item $table->hr + +=cut + +sub hr { + my ( $self ) = @_; + for( 0..@{ $self->{columns} } - 1 ) { + push @{ $self->{columns}->[ $_ ]->[ 1 ] }, undef; + } +} + =item $table->row( @texts ) =cut @@ -127,6 +138,28 @@ return $self; } +sub _draw_hr { + my $self = shift; + my $columns = @{ $self->{columns} } - 1; + my $output = ''; + + for my $j ( 0 .. $columns ) { + my $column = $self->{columns}->[$j]; + my $width = $column->[0]; + my $text = $MIDDLE_BORDER x $width; + if ( ( $j == 0 ) && ( $columns == 0 ) ) { + $text = "$MIDDLE_LEFT$text$MIDDLE_RIGHT"; + } + elsif ( $j == 0 ) { $text = "$MIDDLE_LEFT$text$MIDDLE_SEPARATOR" } + elsif ( $j == $columns ) { $text = "$text$MIDDLE_RIGHT" } + else { $text = "$text$MIDDLE_SEPARATOR" } + $output .= $text; + } + $output .= "\n"; + + return $output; +} + =item $table->draw =cut @@ -179,25 +212,18 @@ } # Title separator - for my $j ( 0 .. $columns ) { - my $column = $self->{columns}->[$j]; - my $width = $column->[0]; - my $text = $MIDDLE_BORDER x $width; - if ( ( $j == 0 ) && ( $columns == 0 ) ) { - $text = "$MIDDLE_LEFT$text$MIDDLE_RIGHT"; - } - elsif ( $j == 0 ) { $text = "$MIDDLE_LEFT$text$MIDDLE_SEPARATOR" } - elsif ( $j == $columns ) { $text = "$text$MIDDLE_RIGHT" } - else { $text = "$text$MIDDLE_SEPARATOR" } - $output .= $text; - } - $output .= "\n"; - + $output .= $self->_draw_hr; } # Rows for my $i ( 0 .. $rows ) { + # Check for horizontal rule + if( !grep { defined $self->{columns}->[$_]->[1]->[$i] } 0..$columns ) { + $output .= $self->_draw_hr; + next; + } + for my $j ( 0 .. $columns ) { my $column = $self->{columns}->[$j]; my $width = $column->[0]; === t/04tables.t ================================================================== --- t/04tables.t (revision 13598) +++ t/04tables.t (local) @@ -1,4 +1,4 @@ -use Test::More tests => 4; +use Test::More tests => 5; use_ok('Text::SimpleTable'); @@ -44,3 +44,21 @@ | orks! | '-------' EOF + +my $t4 = Text::SimpleTable->new(5); +$t4->row('Everything works!'); +$t4->hr; +$t4->row('Everything works!'); +is( $t4->draw, <<"EOF"); +.-------. +| Ever- | +| ythi- | +| ng w- | +| orks! | ++-------+ +| Ever- | +| ythi- | +| ng w- | +| orks! | +'-------' +EOF Index: .cvsignore =================================================================== RCS file: /cvs/extras/rpms/perl-Text-SimpleTable/devel/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 4 May 2007 14:56:05 -0000 1.2 +++ .cvsignore 8 Sep 2008 02:36:53 -0000 1.3 @@ -1 +1 @@ -Text-SimpleTable-0.03.tar.gz +Text-SimpleTable-0.05.tar.gz Index: perl-Text-SimpleTable.spec =================================================================== RCS file: /cvs/extras/rpms/perl-Text-SimpleTable/devel/perl-Text-SimpleTable.spec,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- perl-Text-SimpleTable.spec 5 Mar 2008 15:19:58 -0000 1.3 +++ perl-Text-SimpleTable.spec 8 Sep 2008 02:36:53 -0000 1.4 @@ -1,6 +1,6 @@ Name: perl-Text-SimpleTable -Version: 0.03 -Release: 3%{?dist} +Version: 0.05 +Release: 1%{?dist} Summary: Simple Eyecandy ASCII Tables License: GPL+ or Artistic Group: Development/Libraries @@ -10,13 +10,15 @@ BuildArch: noarch Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +# see http://rt.cpan.org/Public/Bug/Display.html?id=22371 +Patch0: simpletable.patch + # Note pod coverage tests fail at the moment, so we disable them for now. # core -BuildRequires: perl(Test::More) -# cpan -BuildRequires: perl(Module::Build) +BuildRequires: perl(ExtUtils::MakeMaker) # testing +BuildRequires: perl(Test::More) #BuildRequires: perl(Test::Pod), perl(Test::Pod::Coverage) %description @@ -24,22 +26,24 @@ %prep %setup -q -n Text-SimpleTable-%{version} +%patch0 %build -%{__perl} Build.PL installdirs=vendor -./Build +%{__perl} Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} %install rm -rf %{buildroot} -./Build install destdir=%{buildroot} create_packlist=0 +make pure_install PERL_INSTALL_ROOT=%{buildroot} +find %{buildroot} -type f -name .packlist -exec rm -f {} + find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \; %{_fixperms} %{buildroot}/* %check #export TEST_POD=1 -./Build test +make test %clean rm -rf %{buildroot} @@ -51,6 +55,11 @@ %{_mandir}/man3/* %changelog +* Sun Sep 07 2008 Chris Weyl <cweyl@xxxxxxxxxxxxxxx> 0.05-1 +- update to 0.05 +- add patch from CPAN RT#22371 +- change to ExtUtils::MakeMaker incantations + * Wed Mar 05 2008 Tom "spot" Callaway <tcallawa@xxxxxxxxxx> 0.03-3 - rebuild for new perl Index: sources =================================================================== RCS file: /cvs/extras/rpms/perl-Text-SimpleTable/devel/sources,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sources 4 May 2007 14:56:05 -0000 1.2 +++ sources 8 Sep 2008 02:36:53 -0000 1.3 @@ -1 +1 @@ -7eaf266174d4bf2b66f98db28c291b15 Text-SimpleTable-0.03.tar.gz +90f884fec82f85df903ad7934b5351a6 Text-SimpleTable-0.05.tar.gz -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl Fedora-perl-devel-list mailing list Fedora-perl-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-perl-devel-list