r39191 - in /branches/upstream/libtext-simpletable-perl/current: .perltidyrc Changes MANIFEST MANIFEST.SKIP META.yml Makefile.PL README lib/Text/SimpleTable.pm t/01use.t t/02pod.t t/03podcoverage.t t/04tables.t
nhandler-guest at users.alioth.debian.org
nhandler-guest at users.alioth.debian.org
Fri Jul 3 04:06:56 UTC 2009
Author: nhandler-guest
Date: Fri Jul 3 04:06:42 2009
New Revision: 39191
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=39191
Log:
[svn-upgrade] Integrating new upstream version, libtext-simpletable-perl (1.1)
Added:
branches/upstream/libtext-simpletable-perl/current/.perltidyrc
branches/upstream/libtext-simpletable-perl/current/MANIFEST.SKIP
Removed:
branches/upstream/libtext-simpletable-perl/current/README
Modified:
branches/upstream/libtext-simpletable-perl/current/Changes
branches/upstream/libtext-simpletable-perl/current/MANIFEST
branches/upstream/libtext-simpletable-perl/current/META.yml
branches/upstream/libtext-simpletable-perl/current/Makefile.PL
branches/upstream/libtext-simpletable-perl/current/lib/Text/SimpleTable.pm
branches/upstream/libtext-simpletable-perl/current/t/01use.t
branches/upstream/libtext-simpletable-perl/current/t/02pod.t
branches/upstream/libtext-simpletable-perl/current/t/03podcoverage.t
branches/upstream/libtext-simpletable-perl/current/t/04tables.t
Added: branches/upstream/libtext-simpletable-perl/current/.perltidyrc
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/.perltidyrc?rev=39191&op=file
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/.perltidyrc (added)
+++ branches/upstream/libtext-simpletable-perl/current/.perltidyrc Fri Jul 3 04:06:42 2009
@@ -1,0 +1,35 @@
+# Perl Best Practices (plus errata) .perltidyrc file
+
+-l=98 # Max line width is 98 cols
+-i=4 # Indent level is 4 cols
+-ci=4 # Continuation indent is 4 cols
+#-st # Output to STDOUT
+-se # Errors to STDERR
+-vt=2 # Maximal vertical tightness
+-cti=0 # No extra indentation for closing brackets
+-pt=1 # Medium parenthesis tightness
+-bt=1 # Medium brace tightness
+-sbt=1 # Medium square bracket tightness
+-bbt=1 # Medium block brace tightness
+-nsfs # No space before semicolons
+-nolq # Don't outdent long quoted strings
+-wbb="% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
+ # Break before all operators
+
+# extras/overrides/deviations from PBP
+
+--maximum-line-length=78 # be less generous
+--warning-output # Show warnings
+--maximum-consecutive-blank-lines=2 # default is 1
+--nohanging-side-comments # troublesome for commented out code
+
+-isbc # block comments may only be indented if they have some space characters before the #
+-ci=2 # Continuation indent is 2 cols
+
+# we use version control, so just rewrite the file
+-b
+
+# for the up-tight folk :)
+-pt=2 # High parenthesis tightness
+-bt=2 # High brace tightness
+-sbt=2 # High square bracket tightness
Modified: branches/upstream/libtext-simpletable-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/Changes?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/Changes (original)
+++ branches/upstream/libtext-simpletable-perl/current/Changes Fri Jul 3 04:06:42 2009
@@ -1,4 +1,11 @@
Tis file documents the revision history for Perl extension Text::SimpleTable.
+
+1.1 2009-07-02 00:00:00
+ - Added hr method. (bricas)
+
+1.0 2009-07-02 00:00:00
+ - Fixed pod coverage.
+ - Cleanup.
0.05 2008-08-28 00:00:00
- Adden new contact information
Modified: branches/upstream/libtext-simpletable-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/MANIFEST?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/MANIFEST (original)
+++ branches/upstream/libtext-simpletable-perl/current/MANIFEST Fri Jul 3 04:06:42 2009
@@ -1,10 +1,11 @@
+.perltidyrc
Changes
lib/Text/SimpleTable.pm
Makefile.PL
MANIFEST This list of files
-META.yml
-README
+MANIFEST.SKIP
t/01use.t
t/02pod.t
t/03podcoverage.t
t/04tables.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libtext-simpletable-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/MANIFEST.SKIP?rev=39191&op=file
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libtext-simpletable-perl/current/MANIFEST.SKIP Fri Jul 3 04:06:42 2009
@@ -1,0 +1,5 @@
+^blib
+^pm_to_blib
+.*\.old$
+^Makefile$
+^\.git
Modified: branches/upstream/libtext-simpletable-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/META.yml?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/META.yml (original)
+++ branches/upstream/libtext-simpletable-perl/current/META.yml Fri Jul 3 04:06:42 2009
@@ -1,9 +1,10 @@
--- #YAML:1.0
name: Text-SimpleTable
-version: 0.05
+version: 1.1
abstract: ~
license: ~
-author: ~
+author:
+ - Sebastian Riedel <sri at cpan.org>
generated_by: ExtUtils::MakeMaker version 6.42
distribution_type: module
requires:
Modified: branches/upstream/libtext-simpletable-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/Makefile.PL?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/Makefile.PL (original)
+++ branches/upstream/libtext-simpletable-perl/current/Makefile.PL Fri Jul 3 04:06:42 2009
@@ -1,3 +1,7 @@
+#!perl
+
+# Copyright (C) 2005-2009, Sebastian Riedel.
+
use strict;
use warnings;
@@ -6,6 +10,7 @@
# Son, when you participate in sporting events,
# it's not whether you win or lose, it's how drunk you get.
WriteMakefile(
- NAME => 'Text::SimpleTable',
- VERSION_FROM => 'lib/Text/SimpleTable.pm',
+ NAME => 'Text::SimpleTable',
+ VERSION_FROM => 'lib/Text/SimpleTable.pm',
+ AUTHOR => 'Sebastian Riedel <sri at cpan.org>'
);
Modified: branches/upstream/libtext-simpletable-perl/current/lib/Text/SimpleTable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/lib/Text/SimpleTable.pm?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/lib/Text/SimpleTable.pm (original)
+++ branches/upstream/libtext-simpletable-perl/current/lib/Text/SimpleTable.pm Fri Jul 3 04:06:42 2009
@@ -1,30 +1,289 @@
+# Copyright (C) 2005-2009, Sebastian Riedel.
+
package Text::SimpleTable;
use strict;
-our $VERSION = '0.05';
-
+our $VERSION = '1.1';
+
+# Top
our $TOP_LEFT = '.-';
our $TOP_BORDER = '-';
our $TOP_SEPARATOR = '-+-';
our $TOP_RIGHT = '-.';
+# Middle
our $MIDDLE_LEFT = '+-';
our $MIDDLE_BORDER = '-';
our $MIDDLE_SEPARATOR = '-+-';
our $MIDDLE_RIGHT = '-+';
+# Left
our $LEFT_BORDER = '| ';
our $SEPARATOR = ' | ';
our $RIGHT_BORDER = ' |';
+# Bottom
our $BOTTOM_LEFT = "'-";
our $BOTTOM_SEPARATOR = "-+-";
our $BOTTOM_BORDER = '-';
our $BOTTOM_RIGHT = "-'";
+# Wrapper
our $WRAP = '-';
+sub new {
+ my ($class, @args) = @_;
+
+ # Instantiate
+ $class = ref $class || $class;
+ my $self = bless {}, $class;
+
+ # Columns and titles
+ my $cache = [];
+ my $max = 0;
+ for my $arg (@args) {
+ my $width;
+ my $name;
+
+ if (ref $arg) {
+ $width = $arg->[0];
+ $name = $arg->[1];
+ }
+ else { $width = $arg }
+
+ # Wrap
+ my $title = $name ? $self->_wrap($name, $width) : [];
+
+ # Column
+ my $col = [$width, [], $title];
+ $max = @{$col->[2]} if $max < @{$col->[2]};
+ push @$cache, $col;
+ }
+
+ # Padding
+ for my $col (@$cache) {
+ push @{$col->[2]}, '' while @{$col->[2]} < $max;
+ }
+ $self->{columns} = $cache;
+
+ return $self;
+}
+
+# The implementation is not very elegant, but gets the job done very well
+sub draw {
+ my $self = shift;
+
+ # Shortcut
+ return unless $self->{columns};
+
+ my $rows = @{$self->{columns}->[0]->[1]} - 1;
+ my $columns = @{$self->{columns}} - 1;
+ my $output = '';
+
+ # Top border
+ for my $j (0 .. $columns) {
+
+ my $column = $self->{columns}->[$j];
+ my $width = $column->[0];
+ my $text = $TOP_BORDER x $width;
+
+ if (($j == 0) && ($columns == 0)) {
+ $text = "$TOP_LEFT$text$TOP_RIGHT";
+ }
+ elsif ($j == 0) { $text = "$TOP_LEFT$text$TOP_SEPARATOR" }
+ elsif ($j == $columns) { $text = "$text$TOP_RIGHT" }
+ else { $text = "$text$TOP_SEPARATOR" }
+
+ $output .= $text;
+ }
+ $output .= "\n";
+
+ my $title = 0;
+ for my $column (@{$self->{columns}}) {
+ $title = @{$column->[2]} if $title < @{$column->[2]};
+ }
+
+ if ($title) {
+
+ # Titles
+ for my $i (0 .. $title - 1) {
+
+ for my $j (0 .. $columns) {
+
+ my $column = $self->{columns}->[$j];
+ my $width = $column->[0];
+ my $text = $column->[2]->[$i] || '';
+
+ $text = sprintf "%-${width}s", $text;
+
+ if (($j == 0) && ($columns == 0)) {
+ $text = "$LEFT_BORDER$text$RIGHT_BORDER";
+ }
+ elsif ($j == 0) { $text = "$LEFT_BORDER$text$SEPARATOR" }
+ elsif ($j == $columns) { $text = "$text$RIGHT_BORDER" }
+ else { $text = "$text$SEPARATOR" }
+
+ $output .= $text;
+ }
+
+ $output .= "\n";
+ }
+
+ # Title separator
+ $output .= $self->_draw_hr;
+
+ }
+
+ # Rows
+ for my $i (0 .. $rows) {
+
+ # Check for hr
+ 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];
+ my $text = (defined $column->[1]->[$i]) ? $column->[1]->[$i] : '';
+
+ $text = sprintf "%-${width}s", $text;
+
+ if (($j == 0) && ($columns == 0)) {
+ $text = "$LEFT_BORDER$text$RIGHT_BORDER";
+ }
+ elsif ($j == 0) { $text = "$LEFT_BORDER$text$SEPARATOR" }
+ elsif ($j == $columns) { $text = "$text$RIGHT_BORDER" }
+ else { $text = "$text$SEPARATOR" }
+
+ $output .= $text;
+ }
+
+ $output .= "\n";
+ }
+
+ # Bottom border
+ for my $j (0 .. $columns) {
+
+ my $column = $self->{columns}->[$j];
+ my $width = $column->[0];
+ my $text = $BOTTOM_BORDER x $width;
+
+ if (($j == 0) && ($columns == 0)) {
+ $text = "$BOTTOM_LEFT$text$BOTTOM_RIGHT";
+ }
+ elsif ($j == 0) { $text = "$BOTTOM_LEFT$text$BOTTOM_SEPARATOR" }
+ elsif ($j == $columns) { $text = "$text$BOTTOM_RIGHT" }
+ else { $text = "$text$BOTTOM_SEPARATOR" }
+
+ $output .= $text;
+ }
+
+ $output .= "\n";
+
+ return $output;
+}
+
+sub hr {
+ my $self = shift;
+
+ for (0 .. @{$self->{columns}} - 1) {
+ push @{$self->{columns}->[$_]->[1]}, undef;
+ }
+
+ return $self;
+}
+
+sub row {
+ my ($self, @texts) = @_;
+ my $size = @{$self->{columns}} - 1;
+
+ # Shortcut
+ return $self if $size < 0;
+
+ for (1 .. $size) {
+ last if $size <= @texts;
+ push @texts, '';
+ }
+
+ my $cache = [];
+ my $max = 0;
+
+ for my $i (0 .. $size) {
+
+ my $text = shift @texts;
+ my $column = $self->{columns}->[$i];
+ my $width = $column->[0];
+ my $pieces = $self->_wrap($text, $width);
+
+ push @{$cache->[$i]}, @$pieces;
+ $max = @$pieces if @$pieces > $max;
+ }
+
+ for my $col (@{$cache}) { push @{$col}, '' while @{$col} < $max }
+
+ for my $i (0 .. $size) {
+ my $column = $self->{columns}->[$i];
+ my $store = $column->[1];
+ push @{$store}, @{$cache->[$i]};
+ }
+
+ 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;
+}
+
+# Wrap text
+sub _wrap {
+ my ($self, $text, $width) = @_;
+
+ my @cache;
+ my @parts = split "\n", $text;
+
+ for my $part (@parts) {
+
+ while (length $part > $width) {
+ my $subtext;
+ $subtext = substr $part, 0, $width - length($WRAP), '';
+ push @cache, "$subtext$WRAP";
+ }
+
+ push @cache, $part if defined $part;
+ }
+
+ return \@cache;
+}
+
+1;
+__END__
+
=head1 NAME
Text::SimpleTable - Simple Eyecandy ASCII Tables
@@ -33,8 +292,8 @@
use Text::SimpleTable;
- my $t1 = Text::SimpleTable->new( 5, 10 );
- $t1->row( 'foobarbaz', 'yadayadayada' );
+ my $t1 = Text::SimpleTable->new(5, 10);
+ $t1->row('foobarbaz', 'yadayadayada');
print $t1->draw;
.-------+------------.
@@ -42,10 +301,9 @@
| arbaz | ada |
'-------+------------'
-
- my $t2 = Text::SimpleTable->new( [ 5, 'Foo' ], [ 10, 'Bar' ] );
- $t2->row( 'foobarbaz', 'yadayadayada' );
- $t2->row( 'barbarbarbarbar', 'yada' );
+ my $t2 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']);
+ $t2->row('foobarbaz', 'yadayadayada');
+ $t2->row('barbarbarbarbar', 'yada');
print $t2->draw;
.-------+------------.
@@ -59,210 +317,64 @@
| bar | |
'-------+------------'
+ my $t3 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']);
+ $t3->row('foobarbaz', 'yadayadayada');
+ $t3->hr;
+ $t3->row('barbarbarbarbar', 'yada');
+ print $t3->draw;
+
+ .-------+------------.
+ | Foo | Bar |
+ +-------+------------+
+ | foob- | yadayaday- |
+ | arbaz | ada |
+ +-------+------------+
+ | barb- | yada |
+ | arba- | |
+ | rbar- | |
+ | bar | |
+ '-------+------------'
=head1 DESCRIPTION
-Simple eyecandy ASCII tables, as seen in L<Catalyst>.
+Simple eyecandy ASCII tables.
=head1 METHODS
-=over 4
+L<Text::SimpleTable> implements the following methods.
+
+=head2 C<new>
+
+ my $t = Text::SimpleTable->new(5, 10);
+ my $t = Text::SimpleTable->new([5, 'Col1', 10, 'Col2']);
+
+=head2 C<draw>
+
+ my $ascii = $t->draw;
+
+=head2 C<hr>
+
+ $t = $t->hr;
+
+=head2 C<row>
+
+ $t = $t->row('col1 data', 'col2 data');
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at cpan.org>.
+
+=head1 CREDITS
+
+In alphabetical order:
+
+Brian Cassidy
+
+=head1 COPYRIGHT
+
+Copyright (C) 2005-2009, Sebastian Riedel.
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl 5.10.
=cut
-
-sub new {
- my ( $class, @args ) = @_;
- $class = ref $class || $class;
- my $self = bless {}, $class;
- my $cache = [];
- my $max = 0;
- for my $arg (@args) {
- my $width;
- my $name;
- if ( ref $arg ) {
- $width = $arg->[0];
- $name = $arg->[1];
- }
- else { $width = $arg }
- my $title = $name ? $self->_wrap( $name, $width ) : [];
- my $col = [ $width, [], $title ];
- $max = @{ $col->[2] } if $max < @{ $col->[2] };
- push @$cache, $col;
- }
- for my $col (@$cache) {
- push @{ $col->[2] }, '' while @{ $col->[2] } < $max;
- }
- $self->{columns} = $cache;
- return $self;
-}
-
-=item $table->row( @texts )
-
-=cut
-
-sub row {
- my ( $self, @texts ) = @_;
- my $size = @{ $self->{columns} } - 1;
- return $self if $size < 0;
- for ( 1 .. $size ) {
- last if $size <= @texts;
- push @texts, '';
- }
- my $cache = [];
- my $max = 0;
- for my $i ( 0 .. $size ) {
- my $text = shift @texts;
- my $column = $self->{columns}->[$i];
- my $width = $column->[0];
- my $pieces = $self->_wrap( $text, $width );
- push @{ $cache->[$i] }, @$pieces;
- $max = @$pieces if @$pieces > $max;
- }
- for my $col ( @{$cache} ) { push @{$col}, '' while @{$col} < $max }
- for my $i ( 0 .. $size ) {
- my $column = $self->{columns}->[$i];
- my $store = $column->[1];
- push @{$store}, @{ $cache->[$i] };
- }
- return $self;
-}
-
-=item $table->draw
-
-=cut
-
-sub draw {
- my $self = shift;
- return unless $self->{columns};
- my $rows = @{ $self->{columns}->[0]->[1] } - 1;
- my $columns = @{ $self->{columns} } - 1;
- my $output = '';
-
- # Top border
- for my $j ( 0 .. $columns ) {
- my $column = $self->{columns}->[$j];
- my $width = $column->[0];
- my $text = $TOP_BORDER x $width;
- if ( ( $j == 0 ) && ( $columns == 0 ) ) {
- $text = "$TOP_LEFT$text$TOP_RIGHT";
- }
- elsif ( $j == 0 ) { $text = "$TOP_LEFT$text$TOP_SEPARATOR" }
- elsif ( $j == $columns ) { $text = "$text$TOP_RIGHT" }
- else { $text = "$text$TOP_SEPARATOR" }
- $output .= $text;
- }
- $output .= "\n";
-
- my $title = 0;
- for my $column ( @{ $self->{columns} } ) {
- $title = @{ $column->[2] } if $title < @{ $column->[2] };
- }
- if ($title) {
-
- # Titles
- for my $i ( 0 .. $title - 1 ) {
-
- for my $j ( 0 .. $columns ) {
- my $column = $self->{columns}->[$j];
- my $width = $column->[0];
- my $text = $column->[2]->[$i] || '';
- $text = sprintf "%-${width}s", $text;
- if ( ( $j == 0 ) && ( $columns == 0 ) ) {
- $text = "$LEFT_BORDER$text$RIGHT_BORDER";
- }
- elsif ( $j == 0 ) { $text = "$LEFT_BORDER$text$SEPARATOR" }
- elsif ( $j == $columns ) { $text = "$text$RIGHT_BORDER" }
- else { $text = "$text$SEPARATOR" }
- $output .= $text;
- }
- $output .= "\n";
- }
-
- # 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";
-
- }
-
- # Rows
- for my $i ( 0 .. $rows ) {
-
- for my $j ( 0 .. $columns ) {
- my $column = $self->{columns}->[$j];
- my $width = $column->[0];
- my $text
- = ( defined $column->[1]->[$i] ) ? $column->[1]->[$i] : '';
- $text = sprintf "%-${width}s", $text;
- if ( ( $j == 0 ) && ( $columns == 0 ) ) {
- $text = "$LEFT_BORDER$text$RIGHT_BORDER";
- }
- elsif ( $j == 0 ) { $text = "$LEFT_BORDER$text$SEPARATOR" }
- elsif ( $j == $columns ) { $text = "$text$RIGHT_BORDER" }
- else { $text = "$text$SEPARATOR" }
- $output .= $text;
- }
- $output .= "\n";
- }
-
- # Bottom border
- for my $j ( 0 .. $columns ) {
- my $column = $self->{columns}->[$j];
- my $width = $column->[0];
- my $text = $BOTTOM_BORDER x $width;
- if ( ( $j == 0 ) && ( $columns == 0 ) ) {
- $text = "$BOTTOM_LEFT$text$BOTTOM_RIGHT";
- }
- elsif ( $j == 0 ) { $text = "$BOTTOM_LEFT$text$BOTTOM_SEPARATOR" }
- elsif ( $j == $columns ) { $text = "$text$BOTTOM_RIGHT" }
- else { $text = "$text$BOTTOM_SEPARATOR" }
- $output .= $text;
- }
- $output .= "\n";
-
- return $output;
-}
-
-sub _wrap {
- my ( $self, $text, $width ) = @_;
- my @cache;
- my @parts = split "\n", $text;
- for my $part (@parts) {
- while ( length $part > $width ) {
- my $subtext;
- $subtext = substr $part, 0, $width - length($WRAP), '';
- push @cache, "$subtext$WRAP";
- }
- push @cache, $part if defined $part;
- }
- return \@cache;
-}
-
-=back
-
-=head1 SEE ALSO
-
-L<Catalyst>
-
-=head1 AUTHOR
-
-Sebastian Riedel, C<sri at cpan.org>
-
-=head1 COPYRIGHT
-
-This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
-
-=cut
-
-1;
Modified: branches/upstream/libtext-simpletable-perl/current/t/01use.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/t/01use.t?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/t/01use.t (original)
+++ branches/upstream/libtext-simpletable-perl/current/t/01use.t Fri Jul 3 04:06:42 2009
@@ -1,3 +1,10 @@
+#!perl
+
+# Copyright (C) 2005-2009, Sebastian Riedel.
+
+use strict;
+use warnings;
+
use Test::More tests => 1;
use_ok('Text::SimpleTable');
Modified: branches/upstream/libtext-simpletable-perl/current/t/02pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/t/02pod.t?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/t/02pod.t (original)
+++ branches/upstream/libtext-simpletable-perl/current/t/02pod.t Fri Jul 3 04:06:42 2009
@@ -1,7 +1,16 @@
+#!perl
+
+# Copyright (C) 2005-2009, Sebastian Riedel.
+
+use strict;
+use warnings;
+
use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => 'Test::Pod 1.14 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+plan skip_all => 'set TEST_POD to enable this test (developer only!)'
+ unless $ENV{TEST_POD};
+# Marge, it takes two to lie. One to lie and one to listen.
all_pod_files_ok();
Modified: branches/upstream/libtext-simpletable-perl/current/t/03podcoverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/t/03podcoverage.t?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/t/03podcoverage.t (original)
+++ branches/upstream/libtext-simpletable-perl/current/t/03podcoverage.t Fri Jul 3 04:06:42 2009
@@ -1,7 +1,17 @@
+#!perl
+
+# Copyright (C) 2005-2009, Sebastian Riedel.
+
+use strict;
+use warnings;
+
use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+plan skip_all => 'set TEST_POD to enable this test (developer only!)'
+ unless $ENV{TEST_POD};
+# Marge, I'm going to miss you so much. And it's not just the sex.
+# It's also the food preparation.
all_pod_coverage_ok();
Modified: branches/upstream/libtext-simpletable-perl/current/t/04tables.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-simpletable-perl/current/t/04tables.t?rev=39191&op=diff
==============================================================================
--- branches/upstream/libtext-simpletable-perl/current/t/04tables.t (original)
+++ branches/upstream/libtext-simpletable-perl/current/t/04tables.t Fri Jul 3 04:06:42 2009
@@ -1,16 +1,24 @@
-use Test::More tests => 4;
+#!perl
+
+# Copyright (C) 2005-2009, Sebastian Riedel.
+
+use strict;
+use warnings;
+
+use Test::More tests => 5;
use_ok('Text::SimpleTable');
-my $t1 = Text::SimpleTable->new( 5, 10 );
-$t1->row( 'Catalyst', 'rockz!' );
-$t1->row( 'DBIx::Class', 'rockz!' );
-$t1->row( 'Template::Toolkit', 'rockz!' );
-is( $t1->draw, <<"EOF");
+# No titles and multiple rows
+my $t1 = Text::SimpleTable->new(5, 10);
+$t1->row('Catalyst', 'rockz!');
+$t1->row('DBIx::Class', 'suckz!');
+$t1->row('Template::Toolkit', 'rockz!');
+is($t1->draw, <<EOF);
.-------+------------.
| Cata- | rockz! |
| lyst | |
-| DBIx- | rockz! |
+| DBIx- | suckz! |
| ::Cl- | |
| ass | |
| Temp- | rockz! |
@@ -20,12 +28,12 @@
'-------+------------'
EOF
-my $t2 =
- Text::SimpleTable->new( [ 5, 'ROCKZ!' ], [ 10, 'Rockz!' ], [ 7, 'rockz!' ] );
-$t2->row( 'Catalyst', 'DBIx::Class', 'Template::Toolkit', 'HTML::Mason' );
-is( $t2->draw, <<"EOF");
+# Titles and multiple cols
+my $t2 = Text::SimpleTable->new([5, 'ROCKZ!'], [10, 'Suckz!'], [7, 'rockz!']);
+$t2->row('Catalyst', 'DBIx::Class', 'Template::Toolkit', 'HTML::Mason');
+is($t2->draw, <<EOF);
.-------+------------+---------.
-| ROCK- | Rockz! | rockz! |
+| ROCK- | Suckz! | rockz! |
| Z! | | |
+-------+------------+---------+
| Cata- | DBIx::Cla- | Templa- |
@@ -34,9 +42,10 @@
'-------+------------+---------'
EOF
+# Minimal
my $t3 = Text::SimpleTable->new(5);
$t3->row('Everything works!');
-is( $t3->draw, <<"EOF");
+is($t3->draw, <<EOF);
.-------.
| Ever- |
| ythi- |
@@ -44,3 +53,22 @@
| orks! |
'-------'
EOF
+
+# Horizontal rule
+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
More information about the Pkg-perl-cvs-commits
mailing list