summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Bowers <neilb@neilb.org>2021-07-22 22:55:37 +0100
committerNeil Bowers <neilb@neilb.org>2021-07-22 22:55:37 +0100
commit02808a29317f197a61d135685a5105958833e7b3 (patch)
treea3b99471733e74904c0f4e8c5818ed693e04727f
parent41cb5863c312e0d002f7c4f0abc736434d74c13f (diff)
downloadperl-02808a29317f197a61d135685a5105958833e7b3.tar.gz
Updated Text-Tabs+Wrap from 2013.0523 to 2021.0717
-rw-r--r--MANIFEST1
-rw-r--r--cpan/Text-Tabs/lib/Text/Tabs.pm4
-rw-r--r--cpan/Text-Tabs/lib/Text/Wrap.pm4
-rw-r--r--cpan/Text-Tabs/t/37000.t7
-rw-r--r--cpan/Text-Tabs/t/39548.t2
-rw-r--r--cpan/Text-Tabs/t/79766.t4
-rw-r--r--cpan/Text-Tabs/t/Jacobson.t2
-rw-r--r--cpan/Text-Tabs/t/Jacobson2.t2
-rw-r--r--cpan/Text-Tabs/t/Jochen.t2
-rw-r--r--cpan/Text-Tabs/t/Tabs-ElCid.t4
-rw-r--r--cpan/Text-Tabs/t/Wrap-JLB.t4
-rw-r--r--cpan/Text-Tabs/t/belg4mit.t2
-rw-r--r--cpan/Text-Tabs/t/dandv.t1
-rw-r--r--cpan/Text-Tabs/t/dnsparks.t142
-rw-r--r--cpan/Text-Tabs/t/fill.t2
-rw-r--r--cpan/Text-Tabs/t/sep.t2
-rw-r--r--cpan/Text-Tabs/t/sep2.t2
-rw-r--r--cpan/Text-Tabs/t/tabs.t2
-rw-r--r--cpan/Text-Tabs/t/wrap.t2
-rw-r--r--cpan/Text-Tabs/t/wrap_separator2.t4
20 files changed, 167 insertions, 28 deletions
diff --git a/MANIFEST b/MANIFEST
index fd12591d99..29faf4cf5e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2624,6 +2624,7 @@ cpan/Text-Tabs/t/39548.t See if Text::Tabs is working
cpan/Text-Tabs/t/79766.t See if Text::Tabs is working
cpan/Text-Tabs/t/belg4mit.t See if Text::Tabs is working
cpan/Text-Tabs/t/dandv.t See if Text::Tabs is working
+cpan/Text-Tabs/t/dnsparks.t See if Text::Tabs is working
cpan/Text-Tabs/t/fill.t See if Text::Wrap::fill works
cpan/Text-Tabs/t/Jacobson.t See if Text::Tabs is working
cpan/Text-Tabs/t/Jacobson2.t See if Text::Tabs is working
diff --git a/cpan/Text-Tabs/lib/Text/Tabs.pm b/cpan/Text-Tabs/lib/Text/Tabs.pm
index 07fe2b8b02..5deb2dd198 100644
--- a/cpan/Text-Tabs/lib/Text/Tabs.pm
+++ b/cpan/Text-Tabs/lib/Text/Tabs.pm
@@ -1,3 +1,5 @@
+no strict; no warnings;
+
package Text::Tabs;
require Exporter;
@@ -6,7 +8,7 @@ require Exporter;
@EXPORT = qw(expand unexpand $tabstop);
use vars qw($VERSION $SUBVERSION $tabstop $debug);
-$VERSION = 2013.0523;
+$VERSION = '2021.0717';
$SUBVERSION = 'modern';
use strict;
diff --git a/cpan/Text-Tabs/lib/Text/Wrap.pm b/cpan/Text-Tabs/lib/Text/Wrap.pm
index db0d15f610..a91811a02b 100644
--- a/cpan/Text-Tabs/lib/Text/Wrap.pm
+++ b/cpan/Text-Tabs/lib/Text/Wrap.pm
@@ -1,3 +1,5 @@
+no strict; no warnings;
+
package Text::Wrap;
use warnings::register;
@@ -7,7 +9,7 @@ require Exporter;
@EXPORT = qw(wrap fill);
@EXPORT_OK = qw($columns $break $huge);
-$VERSION = 2013.0523;
+$VERSION = '2021.0717';
$SUBVERSION = 'modern';
use 5.010_000;
diff --git a/cpan/Text-Tabs/t/37000.t b/cpan/Text-Tabs/t/37000.t
index 1efbc70f54..f08999e926 100644
--- a/cpan/Text-Tabs/t/37000.t
+++ b/cpan/Text-Tabs/t/37000.t
@@ -1,15 +1,12 @@
-#!/usr/bin/perl -I.
+use strict; use warnings;
#Causes Text::Wrap to die...
-use warnings;
-use strict;
+
use Text::Wrap;
my $toPrint = "(1) Category\t(2 or greater) New Category\n\n";
my $good = "(1) Category\t(2 or greater) New Category\n";
-my $toprint;
-
print "1..6\n";
local($Text::Wrap::break) = '\s';
diff --git a/cpan/Text-Tabs/t/39548.t b/cpan/Text-Tabs/t/39548.t
index 6cca0865c1..8322867c57 100644
--- a/cpan/Text-Tabs/t/39548.t
+++ b/cpan/Text-Tabs/t/39548.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -I.
+no strict; use warnings;
# https://rt.perl.org/rt3/Ticket/Display.html?id=39548
diff --git a/cpan/Text-Tabs/t/79766.t b/cpan/Text-Tabs/t/79766.t
index cc579b2c97..09029a5851 100644
--- a/cpan/Text-Tabs/t/79766.t
+++ b/cpan/Text-Tabs/t/79766.t
@@ -1,7 +1,5 @@
-#!/usr/bin/perl -I.
+use strict; use warnings;
-use warnings;
-use strict;
use Text::Wrap;
use Test::More tests => 2;
diff --git a/cpan/Text-Tabs/t/Jacobson.t b/cpan/Text-Tabs/t/Jacobson.t
index b3465f6cac..2cf1da3f72 100644
--- a/cpan/Text-Tabs/t/Jacobson.t
+++ b/cpan/Text-Tabs/t/Jacobson.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -I.
+no strict; use warnings;
# From: Dan Jacobson <jidanni at jidanni dot org>
diff --git a/cpan/Text-Tabs/t/Jacobson2.t b/cpan/Text-Tabs/t/Jacobson2.t
index 1bce9ed9e8..cf3142d635 100644
--- a/cpan/Text-Tabs/t/Jacobson2.t
+++ b/cpan/Text-Tabs/t/Jacobson2.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -I.
+no strict; no warnings;
use Text::Wrap qw(wrap $columns $huge $break);
diff --git a/cpan/Text-Tabs/t/Jochen.t b/cpan/Text-Tabs/t/Jochen.t
index d4a3a8b76a..a103c95478 100644
--- a/cpan/Text-Tabs/t/Jochen.t
+++ b/cpan/Text-Tabs/t/Jochen.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -I.
+use strict; no warnings;
use Text::Wrap;
diff --git a/cpan/Text-Tabs/t/Tabs-ElCid.t b/cpan/Text-Tabs/t/Tabs-ElCid.t
index 79e265d4db..d2ee7ff078 100644
--- a/cpan/Text-Tabs/t/Tabs-ElCid.t
+++ b/cpan/Text-Tabs/t/Tabs-ElCid.t
@@ -1,4 +1,4 @@
-#!perl
+use strict; use warnings FATAL => 'all';
BEGIN {
if ($] <= 5.010) {
@@ -7,8 +7,6 @@ BEGIN {
}
}
-use strict;
-use warnings "FATAL" => "all";
use Text::Tabs;
require bytes;
diff --git a/cpan/Text-Tabs/t/Wrap-JLB.t b/cpan/Text-Tabs/t/Wrap-JLB.t
index f3d655ade5..7e7263f89a 100644
--- a/cpan/Text-Tabs/t/Wrap-JLB.t
+++ b/cpan/Text-Tabs/t/Wrap-JLB.t
@@ -1,4 +1,4 @@
-#!perl
+use strict; use warnings FATAL => 'all';
BEGIN {
if ($] <= 5.010) {
@@ -7,8 +7,6 @@ BEGIN {
}
}
-use strict;
-use warnings "FATAL" => "all";
use Text::Wrap;
$Text::Wrap::columns = 72;
diff --git a/cpan/Text-Tabs/t/belg4mit.t b/cpan/Text-Tabs/t/belg4mit.t
index 2d10342c5f..b75825b702 100644
--- a/cpan/Text-Tabs/t/belg4mit.t
+++ b/cpan/Text-Tabs/t/belg4mit.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -I.
+use strict; no warnings;
use Text::Wrap;
diff --git a/cpan/Text-Tabs/t/dandv.t b/cpan/Text-Tabs/t/dandv.t
index b6ee69ada1..6aad2eaf4a 100644
--- a/cpan/Text-Tabs/t/dandv.t
+++ b/cpan/Text-Tabs/t/dandv.t
@@ -1,3 +1,4 @@
+no strict; no warnings;
use Text::Wrap;
use Test::More tests => 2;
diff --git a/cpan/Text-Tabs/t/dnsparks.t b/cpan/Text-Tabs/t/dnsparks.t
new file mode 100644
index 0000000000..2e6e6aeaa2
--- /dev/null
+++ b/cpan/Text-Tabs/t/dnsparks.t
@@ -0,0 +1,142 @@
+use strict; use warnings;
+
+BEGIN {
+ if ($ENV{HARNESS_ACTIVE}) {
+ print "1..0 # Skipped: not a regression test\n";
+ exit;
+ }
+ unless (eval { require Benchmark; }) {
+ print "1..0 # Skipped: this test requires Benchmark.pm\n";
+ exit;
+ }
+}
+
+#From: dnsparks@juno.com
+#Subject: Text::Wrap suggestions
+#To: muir@idiom.com
+#Date: Sat, 10 Feb 2001 21:50:29 -0500
+#
+#David,
+#
+#I had a "word wrapping" problem to solve at work the other week.
+#Text::Wrap would have done exactly what I needed, but at work we use
+#Smalltalk. :-) (I ended up thinking about it at home, where I don't have
+#Smalltalk, so I first coded it in Perl and then "translated" my solution
+#at work.)
+#
+#I must admit that I was dealing with a specialized case; I didn't want to
+#prepend any strings on the first or subsequent lines of the paragraph
+#begin created. In other words, had we been using Perl at work, I would
+#have done something like this:
+#
+# use Text::Wrap qw(wrap $columns);
+# # ... set $columns, $string, etc. ...
+# return wrap("", "", $string);
+#
+#By the way, the copy of Wrap.pm came with the IndigoPerl distribution I
+#recently downloaded. This is the version string: $VERSION = 98.112902; I
+#don't know if that's the most recent.
+#
+#When I had some time, I was curious to see how my solution compared to
+#using your module. So, I threw together the following script:
+#
+#The interesting thing, which really surprised me, was that the results
+#seemed to indicate that my version ran faster. I was surprised because
+#I'm used to thinking that the standard Perl modules would always present
+#a better solution than "reinventing the wheel".
+#
+# mine: 24 wallclock secs (18.49 usr + 0.00 sys = 18.49 CPU) @ 54.09/s
+#(n=1000)
+# module: 58 wallclock secs (56.44 usr + 0.02 sys = 56.46 CPU) @ 17.71/s
+#(n=1000)
+#
+#Then, it occurred to me that the diffrence may be attributable to my
+#using substr() vs. the module relying on s///. (I recall reading
+#something on perlmonks.org a while back that indicated that substr() is
+#often faster than s///.)
+#
+#I realize that my solution has its problems (doesn't include ability to
+#specify first/subsequent line prefixes, and the possibility that it may
+#recurse itself out of memory, given a big enough input string). But I
+#though you might be interested in my findings.
+#
+#Dan
+#(perlmonks.org nick: t'mo)
+
+
+use Text::Wrap qw(wrap $columns);
+use Benchmark;
+
+my $testString = 'a;kjdf;ldsjf afkjad;fkjafkjafkj; dsfljasdfkjasfj;dThis
+is a test. It is only a test. Do not be alarmed, as the test should only
+take several seconds to run. Yadda yadda yadda...a;kjdf;ldsjf
+afkjad;fkjafkjafkj; dsfljasdfkjasfj;dThis is a test. It is only a test.
+Do not be alarmed, as the test should only take several seconds to run.
+Yadda yadda yadda...a;kjdf;ldsjf afkjad;fkjafkjafkj;
+dsfljasdfkjasfj;dThis is a test. It is only a test. Do not be alarmed, as
+the test should only take several seconds to run. Yadda yadda
+yadda...a;kjdf;ldsjf afkjad;fkjafkjafkj; dsfljasdfkjasfj;dThis is a test.
+It is only a test. Do not be alarmed, as the test should only take
+several seconds to run. Yadda yadda yadda...' x 5;
+
+$columns = 55;
+
+sub prefix {
+ my $length = shift;
+ my $string = shift;
+
+ return "" if( ! $string );
+
+ return prefix($length, substr($string, 1))
+ if( $string =~ /^\s/ );
+
+ if( length $string <= $length ) {
+ chop($string) while( $string =~ /\s$/ );
+ return $string . "\n";
+ }
+
+ my $pre = substr($string, 0, $length);
+ my $post = substr($string, $length);
+
+ if( $pre =~ /\s$/ ) {
+ chop($pre) while( $pre =~ /\s$/ );
+ return $pre . "\n" . prefix($length, $post);
+ }
+ else {
+ if( $post =~ /^\s/ ) {
+ return $pre . "\n" . prefix($length, $post);
+ }
+ else {
+ if( $pre !~ /\s/ ) {
+ return $pre . "\n" . prefix($length, $post);
+ }
+ else {
+ $pre =~ /(.*)\s+([^\s]*)/;
+ $post = $2 . $post;
+ return $1 . "\n" . prefix($length, $post);
+ }
+ }
+ }
+}
+
+my $x = prefix($columns, $testString);
+my $y = wrap("", "", $testString);
+
+unless ($x ne $y) {
+ print "1..0 # Skipped: dnspark's module doesn't give the same answer\n";
+ exit;
+}
+
+my $cnt = -T STDOUT ? 200 : 40;
+my $results = timethese($cnt, {
+ mine => sub { my $res = prefix($columns, $testString) },
+ module => sub { my $res = wrap("", "", $testString) },
+}, 'none');
+
+if ($results->{module}[1] < $results->{mine}[1]) {
+ print "1..1\nok 1\n";
+} else {
+ print "1..0 # Skipped: Dan's implmentation is faster\n";
+}
+
+
diff --git a/cpan/Text-Tabs/t/fill.t b/cpan/Text-Tabs/t/fill.t
index 8af4a0e9c4..c4f7b7b453 100644
--- a/cpan/Text-Tabs/t/fill.t
+++ b/cpan/Text-Tabs/t/fill.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -I.
+no strict; use warnings;
@tests = (split(/\nEND\n/s, <<DONE));
TEST1
diff --git a/cpan/Text-Tabs/t/sep.t b/cpan/Text-Tabs/t/sep.t
index 094f720bc1..45bf4eee97 100644
--- a/cpan/Text-Tabs/t/sep.t
+++ b/cpan/Text-Tabs/t/sep.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -I.
+no strict; no warnings;
@tests = (split(/\nEND\n/s, <<DONE));
TEST1
diff --git a/cpan/Text-Tabs/t/sep2.t b/cpan/Text-Tabs/t/sep2.t
index 4eb8ab563c..417ef01dc7 100644
--- a/cpan/Text-Tabs/t/sep2.t
+++ b/cpan/Text-Tabs/t/sep2.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -I.
+no strict; no warnings;
@tests = (split(/\nEND\n/s, <<DONE));
TEST1
diff --git a/cpan/Text-Tabs/t/tabs.t b/cpan/Text-Tabs/t/tabs.t
index cd6f32c443..e6f3f3f383 100644
--- a/cpan/Text-Tabs/t/tabs.t
+++ b/cpan/Text-Tabs/t/tabs.t
@@ -1,4 +1,4 @@
-#!/usr/old/bin/perl5.004_01 -w
+no strict; use warnings;
@tests = (split(/\nEND\n/s, <<DONE));
TEST 1 u
diff --git a/cpan/Text-Tabs/t/wrap.t b/cpan/Text-Tabs/t/wrap.t
index b9d51f24b6..e3b890dd38 100644
--- a/cpan/Text-Tabs/t/wrap.t
+++ b/cpan/Text-Tabs/t/wrap.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+no strict; no warnings;
@tests = (split(/\nEND\n/s, <<'DONE'));
TEST1
diff --git a/cpan/Text-Tabs/t/wrap_separator2.t b/cpan/Text-Tabs/t/wrap_separator2.t
index b31864fff5..c9a7654a09 100644
--- a/cpan/Text-Tabs/t/wrap_separator2.t
+++ b/cpan/Text-Tabs/t/wrap_separator2.t
@@ -1,6 +1,6 @@
-#!/usr/local/bin/perl -w
+use strict; use warnings;
+
#Author: Dan Dascalescu
-use strict;
use Test::More tests => 1;
use Text::Wrap;