summaryrefslogtreecommitdiff
path: root/lib/Text
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-20 09:54:10 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-20 09:54:10 +0000
commit58389ed28d97caddc55b782fd9ebca329852f29d (patch)
treecff3fdb23a432361b3677036ea22176ad00f8edc /lib/Text
parent52c93dd194e572ccf0cd84fbd063340b76d1a6ba (diff)
downloadperl-58389ed28d97caddc55b782fd9ebca329852f29d.tar.gz
Update Text::Tabs and Text::Wrap to version 2006.1117
p4raw-id: //depot/perl@29320
Diffstat (limited to 'lib/Text')
-rw-r--r--lib/Text/Tabs.pm9
-rw-r--r--lib/Text/TabsWrap/CHANGELOG9
-rw-r--r--lib/Text/TabsWrap/t/Jacobson.t24
-rw-r--r--lib/Text/TabsWrap/t/Jacobson2.t22
-rwxr-xr-xlib/Text/TabsWrap/t/tabs.t13
-rwxr-xr-xlib/Text/TabsWrap/t/wrap.t29
-rw-r--r--lib/Text/Wrap.pm5
7 files changed, 68 insertions, 43 deletions
diff --git a/lib/Text/Tabs.pm b/lib/Text/Tabs.pm
index ab54c7724f..610e870c11 100644
--- a/lib/Text/Tabs.pm
+++ b/lib/Text/Tabs.pm
@@ -3,11 +3,11 @@ package Text::Tabs;
require Exporter;
-@ISA = qw(Exporter);
+@ISA = (Exporter);
@EXPORT = qw(expand unexpand $tabstop);
use vars qw($VERSION $tabstop $debug);
-$VERSION = 2007.0711_01;
+$VERSION = 2007.1117;
use strict;
@@ -127,11 +127,6 @@ Instead of the C<unexpand -a> command, use:
perl -MText::Tabs -n -e 'print unexpand $_'
-=head1 BUGS
-
-expand doesn't handle newlines very quickly -- do not feed it an
-entire document in one string. Instead feed it an array of lines.
-
=head1 LICENSE
Copyright (C) 1996-2002,2005,2006 David Muir Sharnoff.
diff --git a/lib/Text/TabsWrap/CHANGELOG b/lib/Text/TabsWrap/CHANGELOG
index f82e58479f..8d4171e87d 100644
--- a/lib/Text/TabsWrap/CHANGELOG
+++ b/lib/Text/TabsWrap/CHANGELOG
@@ -1,3 +1,12 @@
+
+Use warnings::warnif instead of just warn for columns < 2. Appled per
+request of Rafael Garcia-Suarez <rgarciasuarez at gmail.com>.
+
+= 2006/11/17
+
+Text::Tabs can handle newlines now so the BUGS section has been removed
+per request from Aristotle Pagaltzis.
+
= 2006/07/11
Further bomb-proofing to pass more tests: Dan Jacobson <jidanni at
diff --git a/lib/Text/TabsWrap/t/Jacobson.t b/lib/Text/TabsWrap/t/Jacobson.t
new file mode 100644
index 0000000000..22d42e4d49
--- /dev/null
+++ b/lib/Text/TabsWrap/t/Jacobson.t
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -I.
+
+# From: Dan Jacobson <jidanni at jidanni dot org>
+
+use Text::Wrap qw(wrap $columns $huge $break);
+
+print "1..1\n";
+
+$huge='overflow';
+$Text::Wrap::columns=9;
+$break="(?<=[,.])";
+eval {
+$a=wrap('','',
+"mmmm,n,ooo,ppp.qqqq.rrrrr,sssssssssssss,ttttttttt,uu,vvv wwwwwwwww####\n");
+};
+
+if ($@) {
+ my $e = $@;
+ $e =~ s/^/# /gm;
+ print $e;
+}
+print $@ ? "not ok 1\n" : "ok 1\n";
+
+
diff --git a/lib/Text/TabsWrap/t/Jacobson2.t b/lib/Text/TabsWrap/t/Jacobson2.t
new file mode 100644
index 0000000000..5874e0ecb2
--- /dev/null
+++ b/lib/Text/TabsWrap/t/Jacobson2.t
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -I.
+
+use Text::Wrap qw(wrap $columns $huge $break);
+
+print "1..1\n";
+
+$huge='overflow';
+$Text::Wrap::columns=9;
+$break="(?<=[,.])";
+eval {
+$a=wrap('','',
+"mmmm,n,ooo,ppp.qqqq.rrrrr.adsljasdf\nlasjdflajsdflajsdfljasdfl\nlasjdflasjdflasf,sssssssssssss,ttttttttt,uu,vvv wwwwwwwww####\n");
+};
+
+if ($@) {
+ my $e = $@;
+ $e =~ s/^/# /gm;
+ print $e;
+}
+print $@ ? "not ok 1\n" : "ok 1\n";
+
+
diff --git a/lib/Text/TabsWrap/t/tabs.t b/lib/Text/TabsWrap/t/tabs.t
index 2856aff75b..1bba9a63e2 100755
--- a/lib/Text/TabsWrap/t/tabs.t
+++ b/lib/Text/TabsWrap/t/tabs.t
@@ -1,9 +1,4 @@
-#!./perl -w
-
-BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
-}
+#!/usr/old/bin/perl5.004_01 -w
@tests = (split(/\nEND\n/s, <<DONE));
TEST 1 u
@@ -91,9 +86,9 @@ DONE
$| = 1;
-my $testcount = "1..";
-$testcount .= @tests/2;
-print "$testcount\n";
+print "1..";
+print @tests/2;
+print "\n";
use Text::Tabs;
diff --git a/lib/Text/TabsWrap/t/wrap.t b/lib/Text/TabsWrap/t/wrap.t
index 8ff4217826..37ffbb5db8 100755
--- a/lib/Text/TabsWrap/t/wrap.t
+++ b/lib/Text/TabsWrap/t/wrap.t
@@ -1,11 +1,6 @@
-#!./perl -w
+#!/usr/bin/perl5.00502
-BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
-}
-
-@tests = (split(/\nEND\n/s, <<'DONE'));
+@tests = (split(/\nEND\n/s, <<DONE));
TEST1
This
is
@@ -117,17 +112,6 @@ END
Lines
END
-TEST13 break=\d
-I saw 3 ships come sailing in
-END
- I saw 3 ships come sailing in
-END
-TEST14 break=\d
-the.quick.brown.fox.jumps.over.the.9.lazy.dogs.for.no.good.reason.whatsoever.apparently
-END
- the.quick.brown.fox.jumps.over.the.
- .lazy.dogs.for.no.good.reason.whatsoever.apparently
-END
DONE
@@ -146,9 +130,7 @@ while (@st) {
my $in = shift(@st);
my $out = shift(@st);
- $in =~ s/^TEST(\d+)( break=(.*))?\n//
- or die "bad TEST header line: $in\n";
- local $Text::Wrap::break = $3 if defined $3;
+ $in =~ s/^TEST(\d+)?\n//;
my $back = wrap(' ', ' ', $in);
@@ -182,10 +164,7 @@ while(@st) {
my $in = shift(@st);
my $out = shift(@st);
- $in =~ s/^TEST(\d+)( break=(.*))?\n//
- or die "bad TEST header line: $in\n";
- local $Text::Wrap::break = $3 if defined $3;
-
+ $in =~ s/^TEST(\d+)?\n//;
my @in = split("\n", $in, -1);
@in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
diff --git a/lib/Text/Wrap.pm b/lib/Text/Wrap.pm
index b0e15a7f07..4d2b8e88ce 100644
--- a/lib/Text/Wrap.pm
+++ b/lib/Text/Wrap.pm
@@ -1,12 +1,13 @@
package Text::Wrap;
+use warnings::register;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(wrap fill);
@EXPORT_OK = qw($columns $break $huge);
-$VERSION = 2006.0711;
+$VERSION = 2006.1117;
use vars qw($VERSION $columns $debug $break $huge $unexpand $tabstop
$separator $separator2);
@@ -62,7 +63,7 @@ sub wrap
} elsif ($huge eq 'die') {
die "couldn't wrap '$t'";
} elsif ($columns < 2) {
- warn "Increasing \$Text::Wrap::columns from $columns to 2";
+ warnings::warnif "Increasing \$Text::Wrap::columns from $columns to 2";
$columns = 2;
return ($ip, $xp, @t);
} else {