summaryrefslogtreecommitdiff
path: root/lib/Text
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-09 11:18:15 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-09 11:18:15 +0100
commitc2426eea1ed163f307f1d413f5063236b7743954 (patch)
tree3ed2587e50b65b97c0b190b50f438ef3f27238d0 /lib/Text
parent3dc3a5970f33d7064ab6c66f35aa3f8f7aa77f54 (diff)
downloadperl-c2426eea1ed163f307f1d413f5063236b7743954.tar.gz
Redo move Text::Tabs/Text::Wrap from lib to ext.
This reverts commit a1095a4f24eae80e3fe213e9767581fedc24e3ac, which reverted commit 4f87fa576f174a31e6d8fdb08cae76e644395db0. Conflicts: MANIFEST ext/.gitignore lib/.gitignore
Diffstat (limited to 'lib/Text')
-rw-r--r--lib/Text/Tabs.pm136
-rw-r--r--lib/Text/TabsWrap/CHANGELOG127
-rw-r--r--lib/Text/TabsWrap/t/37000.t29
-rw-r--r--lib/Text/TabsWrap/t/39548.t11
-rw-r--r--lib/Text/TabsWrap/t/Jacobson.t24
-rw-r--r--lib/Text/TabsWrap/t/Jacobson2.t22
-rw-r--r--lib/Text/TabsWrap/t/Jochen.t11
-rw-r--r--lib/Text/TabsWrap/t/belg4mit.t18
-rw-r--r--lib/Text/TabsWrap/t/dandv.t8
-rw-r--r--lib/Text/TabsWrap/t/fill.t105
-rw-r--r--lib/Text/TabsWrap/t/sep.t173
-rw-r--r--lib/Text/TabsWrap/t/sep2.t188
-rw-r--r--lib/Text/TabsWrap/t/tabs.t136
-rw-r--r--lib/Text/TabsWrap/t/wrap.t225
-rw-r--r--lib/Text/TabsWrap/t/wrap_separator2.t13
-rw-r--r--lib/Text/Wrap.pm265
16 files changed, 0 insertions, 1491 deletions
diff --git a/lib/Text/Tabs.pm b/lib/Text/Tabs.pm
deleted file mode 100644
index d3c06a08c1..0000000000
--- a/lib/Text/Tabs.pm
+++ /dev/null
@@ -1,136 +0,0 @@
-
-package Text::Tabs;
-
-require Exporter;
-
-@ISA = (Exporter);
-@EXPORT = qw(expand unexpand $tabstop);
-
-use vars qw($VERSION $tabstop $debug);
-$VERSION = 2009.0305;
-
-use strict;
-
-BEGIN {
- $tabstop = 8;
- $debug = 0;
-}
-
-sub expand {
- my @l;
- my $pad;
- for ( @_ ) {
- my $s = '';
- for (split(/^/m, $_, -1)) {
- my $offs = 0;
- s{\t}{
- $pad = $tabstop - (pos() + $offs) % $tabstop;
- $offs += $pad - 1;
- " " x $pad;
- }eg;
- $s .= $_;
- }
- push(@l, $s);
- }
- return @l if wantarray;
- return $l[0];
-}
-
-sub unexpand
-{
- my (@l) = @_;
- my @e;
- my $x;
- my $line;
- my @lines;
- my $lastbit;
- my $ts_as_space = " "x$tabstop;
- for $x (@l) {
- @lines = split("\n", $x, -1);
- for $line (@lines) {
- $line = expand($line);
- @e = split(/(.{$tabstop})/,$line,-1);
- $lastbit = pop(@e);
- $lastbit = ''
- unless defined $lastbit;
- $lastbit = "\t"
- if $lastbit eq $ts_as_space;
- for $_ (@e) {
- if ($debug) {
- my $x = $_;
- $x =~ s/\t/^I\t/gs;
- print "sub on '$x'\n";
- }
- s/ +$/\t/;
- }
- $line = join('',@e, $lastbit);
- }
- $x = join("\n", @lines);
- }
- return @l if wantarray;
- return $l[0];
-}
-
-1;
-__END__
-
-sub expand
-{
- my (@l) = @_;
- for $_ (@l) {
- 1 while s/(^|\n)([^\t\n]*)(\t+)/
- $1. $2 . (" " x
- ($tabstop * length($3)
- - (length($2) % $tabstop)))
- /sex;
- }
- return @l if wantarray;
- return $l[0];
-}
-
-
-=head1 NAME
-
-Text::Tabs -- expand and unexpand tabs per the unix expand(1) and unexpand(1)
-
-=head1 SYNOPSIS
-
- use Text::Tabs;
-
- $tabstop = 4; # default = 8
- @lines_without_tabs = expand(@lines_with_tabs);
- @lines_with_tabs = unexpand(@lines_without_tabs);
-
-=head1 DESCRIPTION
-
-Text::Tabs does about what the unix utilities expand(1) and unexpand(1)
-do. Given a line with tabs in it, expand will replace the tabs with
-the appropriate number of spaces. Given a line with or without tabs in
-it, unexpand will add tabs when it can save bytes by doing so (just
-like C<unexpand -a>). Invisible compression with plain ASCII!
-
-=head1 EXAMPLE
-
- #!perl
- # unexpand -a
- use Text::Tabs;
-
- while (<>) {
- print unexpand $_;
- }
-
-Instead of the C<expand> comand, use:
-
- perl -MText::Tabs -n -e 'print expand $_'
-
-Instead of the C<unexpand -a> command, use:
-
- perl -MText::Tabs -n -e 'print unexpand $_'
-
-=head1 LICENSE
-
-Copyright (C) 1996-2002,2005,2006 David Muir Sharnoff.
-Copyright (C) 2005 Aristotle Pagaltzis
-This module may be modified, used, copied, and redistributed at your own risk.
-Publicly redistributed modified versions must use a different name.
-
diff --git a/lib/Text/TabsWrap/CHANGELOG b/lib/Text/TabsWrap/CHANGELOG
deleted file mode 100644
index df839794c5..0000000000
--- a/lib/Text/TabsWrap/CHANGELOG
+++ /dev/null
@@ -1,127 +0,0 @@
-
-= 2009/03/05
-
-Test improvements from Dave Mitchel sent back in 2005...
-
-Added code to increase $columns if it's not big enough to accommodate
-the subsequent tab.
-
-Minor documentation fixes from David Landgren <david at landgren.net>.
-
-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
-jidanni dot org> found another way to generate a "this shouldn't happen".
-
-= 2006/07/05
-
-Made documentation and code changes to address perlbug:
-https://rt.perl.org/rt3/Ticket/Display.html?id=30229
-
-Added in changes from the distributed-with-perl version. This took
-care of perlbug: https://rt.perl.org/rt3/Ticket/Display.html?id=34902
-It also took care of suggestion from Matthijs Bomhoff <matthijs
-at bomhoff dot nl>.
-
-Made documentation changes (added EXAMPLES) as per a suggestion
-from Gabor Blasko <gblasko at cs dot columbia dot edu>
-
-belg4mit at MIT dot EDU reported that $columns==1 die'd. No longer.
-
-Added tests for each bug report.
-
-= 2005/08/24
-
-Added $separator2 and tests for $separator and $separator2
-
-Aristotle Pagaltzis <pagaltzis at gmx.de> contributed a new version of
-expand() that is faster.
-
-Jarkko Hietaniemi <jhi at cc.hut.fi> sent in perl change #17917 which
-fixed a bug in wrap.
-
-Matthew Durante <matthew_durante at hotmail.com> and
-Don Buchholz <don at truedisk.com> sent in a doc patches.
-
-= 2001/09/29
-
-Philip Newton <Philip.Newton at gmx.net> sent in a clean patch that
-added support for defining words differently; that prevents
-Text::Wrap from untainting strings; and that fixes a documentation
-bug.
-
-So that fill.t can be used in the version included in the perl
-distribution, fill.t no longer uses File::Slurp.
-
-Both Sweth Chandramouli <svc at sweth.net> and Drew Degentesh
-<ddegentesh at daed.com> both objected to the automatic unexpand
-that Text::Wrap does on its results. Drew sent a patch which
-has been integrated.
-
-Way back in '97, Joel Earl <jrearl at VNET.IBM.COM> asked that
-it be possible to use a line separator other than \n when
-adding new lines. There is now support for that.
-
-= 2001/01/30
-
-Bugfix by Michael G Schwern <schwern at pobox.com>: don't add extra
-whitespace when working one an array of input (as opposed to a
-single string).
-
-Performance rewrite: use m/\G/ rather than s///.
-
-You can now specify that words that are too long to wrap can simply
-overflow the line. Feature requested by James Hoagland
-<hoagland at SiliconDefense.com> and by John Porter <jdporter at min.net>.
-
-Documentation changes from Rich Bowen <Rich at cre8tivegroup.com>.
-
-= 1998/11/29
-
-Combined Fill.pm into Wrap.pm. It appears there are versions of
-Wrap.pm with fill in them.
-
-= 1998/11/28
-
-Over the last couple of years, many people sent in various
-rewrites of Text::Wrap. I should have done something about
-updating it long ago. If someone wants to take it over from
-me, discuss it in perl-porters. I'll be happy to hand it
-over.
-
-Anyway, I have a bunch of people to thank. I didn't
-use what any of them sent in, but I did take ideas from
-all of them. Many sent in complete new implamentations.
-
- Ivan Brawley <ibrawley at awadi.com.au>
-
- Jacqui Caren <Jacqui.Caren at ig.co.uk>
-
- Jeff Kowalski <jeff.kowalski at autodesk.com>
-
- Allen Smith <easmith at beatrice.rutgers.edu>
-
- Sullivan N. Beck <sbeck at cise.ufl.edu>
-
-The end result is a very slight change in the API. There
-is now an additional package variable: $Text::Wrap::huge.
-When $huge is set to 'die' then long words will cause
-wrap() to die. When it is set to 'wrap', long words will
-be wrapped. The default is 'wrap'.
-
-<shout>LONG WORDS WILL NOW BE WRAPPED BY DEFAULT</shout>.
-This is a change in behavior.
-
-At the bottom of Text::Wrap, there was a function (fill())
-sitting there unpublished. There was a note that Tim Pierce
-had a faster version, but a search on CPAN failed to turn it
-up. Text::Fill is now available.
-
diff --git a/lib/Text/TabsWrap/t/37000.t b/lib/Text/TabsWrap/t/37000.t
deleted file mode 100644
index 1efbc70f54..0000000000
--- a/lib/Text/TabsWrap/t/37000.t
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/perl -I.
-
-#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';
-eval { $toPrint = wrap("","",$toPrint); };
-print $@ ? "not ok 1\n" : "ok 1\n";
-print $toPrint eq $good ? "ok 2\n" : "not ok 2\n";
-
-local($Text::Wrap::break) = '\d';
-eval { $toPrint = wrap("","",$toPrint); };
-print $@ ? "not ok 3\n" : "ok 3\n";
-print $toPrint eq $good ? "ok 4\n" : "not ok 4\n";
-
-local($Text::Wrap::break) = 'a';
-eval { $toPrint = wrap("","",$toPrint); };
-print $@ ? "not ok 5\n" : "ok 5\n";
-print $toPrint eq $good ? "ok 6\n" : "not ok 6\n";
-
diff --git a/lib/Text/TabsWrap/t/39548.t b/lib/Text/TabsWrap/t/39548.t
deleted file mode 100644
index 6cca0865c1..0000000000
--- a/lib/Text/TabsWrap/t/39548.t
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/perl -w -I.
-
-# https://rt.perl.org/rt3/Ticket/Display.html?id=39548
-
-print "1..1\n";
-require Text::Wrap;
-$VAR1 = " (Karl-Bonhoeffer-Nervenklinik zwischen Hermann-Piper-Str. und U-Bahnhof) ";
-$VAR2 = " ";
-$VAR3 = "(5079,19635 5124,19634 5228,19320 5246,19244)\n";
-eval { Text::Wrap::wrap($VAR1,$VAR2,$VAR3); };
-print $@ ? "not ok 1\n" : "ok 1\n";
diff --git a/lib/Text/TabsWrap/t/Jacobson.t b/lib/Text/TabsWrap/t/Jacobson.t
deleted file mode 100644
index d2727e4629..0000000000
--- a/lib/Text/TabsWrap/t/Jacobson.t
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/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=$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
deleted file mode 100644
index b7b06faf82..0000000000
--- a/lib/Text/TabsWrap/t/Jacobson2.t
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/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=$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/Jochen.t b/lib/Text/TabsWrap/t/Jochen.t
deleted file mode 100644
index d4a3a8b76a..0000000000
--- a/lib/Text/TabsWrap/t/Jochen.t
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/perl -I.
-
-use Text::Wrap;
-
-print "1..1\n";
-
-$Text::Wrap::columns = 1;
-eval { wrap('', '', ''); };
-
-print $@ ? "not ok 1\n" : "ok 1\n";
-
diff --git a/lib/Text/TabsWrap/t/belg4mit.t b/lib/Text/TabsWrap/t/belg4mit.t
deleted file mode 100644
index 2d10342c5f..0000000000
--- a/lib/Text/TabsWrap/t/belg4mit.t
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/perl -I.
-
-use Text::Wrap;
-
-print "1..1\n";
-
-$Text::Wrap::columns = 1;
-eval { wrap('', '', 'H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm
-OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8
-Opr8bBBidccAAAA'); };
-
-if ($@) {
- my $e = $@;
- $e =~ s/^/# /gm;
- print $e;
-}
-print $@ ? "not ok 1\n" : "ok 1\n";
-
diff --git a/lib/Text/TabsWrap/t/dandv.t b/lib/Text/TabsWrap/t/dandv.t
deleted file mode 100644
index b6ee69ada1..0000000000
--- a/lib/Text/TabsWrap/t/dandv.t
+++ /dev/null
@@ -1,8 +0,0 @@
-
-use Text::Wrap;
-use Test::More tests => 2;
-$Text::Wrap::columns = 4;
-eval { $x = Text::Wrap::wrap('', '123', 'some text'); };
-is($@, '');
-is($x, "some\n123t\n123e\n123x\n123t");
-
diff --git a/lib/Text/TabsWrap/t/fill.t b/lib/Text/TabsWrap/t/fill.t
deleted file mode 100644
index dab043297e..0000000000
--- a/lib/Text/TabsWrap/t/fill.t
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/perl -w -I.
-
-@tests = (split(/\nEND\n/s, <<DONE));
-TEST1
-Cyberdog Information
-
-Cyberdog & Netscape in the news
-Important Press Release regarding Cyberdog and Netscape. Check it out!
-
-Cyberdog Plug-in Support!
-Cyberdog support for Netscape Plug-ins is now available to download! Go
-to the Cyberdog Beta Download page and download it now!
-
-Cyberdog Book
-Check out Jesse Feiler's way-cool book about Cyberdog. You can find
-details out about the book as well as ordering information at Philmont
-Software Mill site.
-
-Java!
-Looking to view Java applets in Cyberdog 1.1 Beta 3? Download and install
-the Mac OS Runtime for Java and try it out!
-
-Cyberdog 1.1 Beta 3
-We hope that Cyberdog and OpenDoc 1.1 will be available within the next
-two weeks. In the meantime, we have released another version of
-Cyberdog, Cyberdog 1.1 Beta 3. This version fixes several bugs that were
-reported to us during out public beta period. You can check out our release
-notes to see what we fixed!
-END
- Cyberdog Information
- Cyberdog & Netscape in the news Important Press Release regarding
- Cyberdog and Netscape. Check it out!
- Cyberdog Plug-in Support! Cyberdog support for Netscape Plug-ins is now
- available to download! Go to the Cyberdog Beta Download page and download
- it now!
- Cyberdog Book Check out Jesse Feiler's way-cool book about Cyberdog.
- You can find details out about the book as well as ordering information at
- Philmont Software Mill site.
- Java! Looking to view Java applets in Cyberdog 1.1 Beta 3? Download and
- install the Mac OS Runtime for Java and try it out!
- Cyberdog 1.1 Beta 3 We hope that Cyberdog and OpenDoc 1.1 will be
- available within the next two weeks. In the meantime, we have released
- another version of Cyberdog, Cyberdog 1.1 Beta 3. This version fixes
- several bugs that were reported to us during out public beta period. You
- can check out our release notes to see what we fixed!
-END
-DONE
-
-
-$| = 1;
-
-print "1..";
-print @tests/2;
-print "\n";
-
-use Text::Wrap;
-
-$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
-
-$tn = 1;
-while (@tests) {
- my $in = shift(@tests);
- my $out = shift(@tests);
-
- $in =~ s/^TEST(\d+)?\n//;
-
- my $back = fill(' ', ' ', $in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- write_file("#o", $back);
- write_file("#e", $out);
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input ------------\n";
- print $in;
- print "\n------------ output -----------\n";
- print $back;
- print "\n------------ expected ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- fill(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-}
-
-sub write_file
-{
- my ($f, @data) = @_;
-
- local(*F);
-
- open(F, ">$f") || die "open >$f: $!";
- (print F @data) || die "write $f: $!";
- close(F) || die "close $f: $!";
- return 1;
-}
diff --git a/lib/Text/TabsWrap/t/sep.t b/lib/Text/TabsWrap/t/sep.t
deleted file mode 100644
index 094f720bc1..0000000000
--- a/lib/Text/TabsWrap/t/sep.t
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/perl -I.
-
-@tests = (split(/\nEND\n/s, <<DONE));
-TEST1
-This
-is
-a
-test
-END
- This = is= a= test
-END
-TEST2
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-END
- This is a test of a very long line. It should be broken up and put onto= multiple lines.= This is a test of a very long line. It should be broken up and put onto= multiple lines.= = This is a test of a very long line. It should be broken up and put onto= multiple lines.
-END
-TEST3
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-END
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
-END
-TEST4
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-
-END
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
-
-END
-TEST5
-This is a test of a very long line. It should be broken up and put onto multiple This is a test of a very long line. It should be broken up and put
-END
- This is a test of a very long line. It should be broken up and put onto= multiple This is a test of a very long line. It should be broken up and= put
-END
-TEST6
-11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
-END
- 11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888= 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff= gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn= ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
-END
-TEST7
-c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6 c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0 c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0 c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
-END
- c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6= c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0= c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0= c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
-END
-TEST8
-A test of a very very long word.
-a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
-END
- A test of a very very long word.= a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
-END
-TEST9
-A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
-END
- A test of a very very long word. = a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
-END
-TEST10
-my mother once said
-"never eat paste my darling"
-would that I heeded
-END
- my mother once said= "never eat paste my darling"= would that I heeded
-END
-TEST11
-This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
-END
- This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr= ogram_does_not_crash_and_burn
-END
-TEST12
-This
-
-Has
-
-Blank
-
-Lines
-
-END
- This= = Has= = Blank= = Lines
-
-END
-DONE
-
-
-$| = 1;
-
-print "1..", 1 +@tests, "\n";
-
-use Text::Wrap;
-$Text::Wrap::separator = '=';
-
-$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
-
-$tn = 1;
-
-@st = @tests;
-while (@st) {
- my $in = shift(@st);
- my $out = shift(@st);
-
- $in =~ s/^TEST(\d+)?\n//;
-
- my $back = wrap(' ', ' ', $in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input ------------\n";
- print $in;
- print "\n------------ output -----------\n";
- print $back;
- print "\n------------ expected ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- wrap(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-
-}
-
-@st = @tests;
-while(@st) {
- my $in = shift(@st);
- my $out = shift(@st);
-
- $in =~ s/^TEST(\d+)?\n//;
-
- my @in = split("\n", $in, -1);
- @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
-
- my $back = wrap(' ', ' ', @in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input2 ------------\n";
- print $in;
- print "\n------------ output2 -----------\n";
- print $back;
- print "\n------------ expected2 ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- wrap(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-}
-
-$Text::Wrap::huge = 'overflow';
-
-my $tw = 'This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn';
-my $w = wrap('zzz','yyy',$tw);
-print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
-$tn++;
-
diff --git a/lib/Text/TabsWrap/t/sep2.t b/lib/Text/TabsWrap/t/sep2.t
deleted file mode 100644
index 4eb8ab563c..0000000000
--- a/lib/Text/TabsWrap/t/sep2.t
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/usr/bin/perl -I.
-
-@tests = (split(/\nEND\n/s, <<DONE));
-TEST1
-This
-is
-a
-test
-END
- This
- is
- a
- test
-END
-TEST2
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-END
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
-
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
-END
-TEST3
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-END
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
-END
-TEST4
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-
-END
- This is a test of a very long line. It should be broken up and put onto= multiple lines.
-
-END
-TEST5
-This is a test of a very long line. It should be broken up and put onto multiple This is a test of a very long line. It should be broken up and put
-END
- This is a test of a very long line. It should be broken up and put onto= multiple This is a test of a very long line. It should be broken up and= put
-END
-TEST6
-11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
-END
- 11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888= 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff= gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn= ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
-END
-TEST7
-c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6 c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0 c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0 c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
-END
- c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6= c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0= c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0= c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
-END
-TEST8
-A test of a very very long word.
-a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
-END
- A test of a very very long word.
- a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
-END
-TEST9
-A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
-END
- A test of a very very long word. = a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
-END
-TEST10
-my mother once said
-"never eat paste my darling"
-would that I heeded
-END
- my mother once said
- "never eat paste my darling"
- would that I heeded
-END
-TEST11
-This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
-END
- This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr= ogram_does_not_crash_and_burn
-END
-TEST12
-This
-
-Has
-
-Blank
-
-Lines
-
-END
- This
-
- Has
-
- Blank
-
- Lines
-
-END
-DONE
-
-
-$| = 1;
-
-print "1..", 1 +@tests, "\n";
-
-use Text::Wrap;
-$Text::Wrap::separator2 = '=';
-
-$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
-
-$tn = 1;
-
-@st = @tests;
-while (@st) {
- my $in = shift(@st);
- my $out = shift(@st);
-
- $in =~ s/^TEST(\d+)?\n//;
-
- my $back = wrap(' ', ' ', $in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input ------------\n";
- print $in;
- print "\n------------ output -----------\n";
- print $back;
- print "\n------------ expected ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- wrap(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-
-}
-
-@st = @tests;
-while(@st) {
- my $in = shift(@st);
- my $out = shift(@st);
-
- $in =~ s/^TEST(\d+)?\n//;
-
- my @in = split("\n", $in, -1);
- @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
-
- my $back = wrap(' ', ' ', @in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input2 ------------\n";
- print $in;
- print "\n------------ output2 -----------\n";
- print $back;
- print "\n------------ expected2 ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- wrap(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-}
-
-$Text::Wrap::huge = 'overflow';
-
-my $tw = 'This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn';
-my $w = wrap('zzz','yyy',$tw);
-print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
-$tn++;
-
diff --git a/lib/Text/TabsWrap/t/tabs.t b/lib/Text/TabsWrap/t/tabs.t
deleted file mode 100644
index 1bba9a63e2..0000000000
--- a/lib/Text/TabsWrap/t/tabs.t
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/old/bin/perl5.004_01 -w
-
-@tests = (split(/\nEND\n/s, <<DONE));
-TEST 1 u
- x
-END
- x
-END
-TEST 2 e
- x
-END
- x
-END
-TEST 3 e
- x
- y
- z
-END
- x
- y
- z
-END
-TEST 4 u
- x
- y
- z
-END
- x
- y
- z
-END
-TEST 5 u
-This Is a test of a line with many embedded tabs
-END
-This Is a test of a line with many embedded tabs
-END
-TEST 6 e
-This Is a test of a line with many embedded tabs
-END
-This Is a test of a line with many embedded tabs
-END
-TEST 7 u
- x
-END
- x
-END
-TEST 8 e
-
-
-
-
-
-END
-
-
-
-
-
-END
-TEST 9 u
-
-END
-
-END
-TEST 10 u
-
-
-
-
-
-END
-
-
-
-
-
-END
-TEST 11 u
-foobar IN A 140.174.82.12
-
-END
-foobar IN A 140.174.82.12
-
-END
-DONE
-
-$| = 1;
-
-print "1..";
-print @tests/2;
-print "\n";
-
-use Text::Tabs;
-
-$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
-
-$tn = 1;
-while (@tests) {
- my $in = shift(@tests);
- my $out = shift(@tests);
-
- $in =~ s/^TEST\s*(\d+)?\s*(\S+)?\n//;
-
- if ($2 eq 'e') {
- $f = \&expand;
- $fn = 'expand';
- } else {
- $f = \&unexpand;
- $fn = 'unexpand';
- }
-
- my $back = &$f($in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input ------------\n";
- print $in;
- print "\$\n------------ $fn -----------\n";
- print $back;
- print "\$\n------------ expected ---------\n";
- print $out;
- print "\$\n-------------------------------\n";
- $Text::Tabs::debug = 1;
- my $back = &$f($in);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-}
diff --git a/lib/Text/TabsWrap/t/wrap.t b/lib/Text/TabsWrap/t/wrap.t
deleted file mode 100644
index b9d51f24b6..0000000000
--- a/lib/Text/TabsWrap/t/wrap.t
+++ /dev/null
@@ -1,225 +0,0 @@
-#!/usr/bin/perl
-
-@tests = (split(/\nEND\n/s, <<'DONE'));
-TEST1
-This
-is
-a
-test
-END
- This
- is
- a
- test
-END
-TEST2
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-END
- This is a test of a very long line. It should be broken up and put onto
- multiple lines.
- This is a test of a very long line. It should be broken up and put onto
- multiple lines.
-
- This is a test of a very long line. It should be broken up and put onto
- multiple lines.
-END
-TEST3
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-END
- This is a test of a very long line. It should be broken up and put onto
- multiple lines.
-END
-TEST4
-This is a test of a very long line. It should be broken up and put onto multiple lines.
-
-END
- This is a test of a very long line. It should be broken up and put onto
- multiple lines.
-
-END
-TEST5
-This is a test of a very long line. It should be broken up and put onto multiple This is a test of a very long line. It should be broken up and put
-END
- This is a test of a very long line. It should be broken up and put onto
- multiple This is a test of a very long line. It should be broken up and
- put
-END
-TEST6
-11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
-END
- 11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888
- 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff
- gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn
- ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
-END
-TEST7
-c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6 c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0 c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0 c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
-END
- c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6
- c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0
- c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0
- c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
-END
-TEST8
-A test of a very very long word.
-a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
-END
- A test of a very very long word.
- a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123
- 4567
-END
-TEST9
-A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
-END
- A test of a very very long word.
- a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123
- 4567
-END
-TEST10
-my mother once said
-"never eat paste my darling"
-would that I heeded
-END
- my mother once said
- "never eat paste my darling"
- would that I heeded
-END
-TEST11
-This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
-END
- This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr
- ogram_does_not_crash_and_burn
-END
-TEST12
-This
-
-Has
-
-Blank
-
-Lines
-
-END
- This
-
- Has
-
- Blank
-
- 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
-
-
-$| = 1;
-
-print "1..", 2 +@tests, "\n";
-
-use Text::Wrap;
-
-$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
-
-$tn = 1;
-
-@st = @tests;
-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;
-
- my $back = wrap(' ', ' ', $in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input ------------\n";
- print $in;
- print "\n------------ output -----------\n";
- print $back;
- print "\n------------ expected ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- wrap(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-
-}
-
-@st = @tests;
-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;
-
- my @in = split("\n", $in, -1);
- @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
-
- my $back = wrap(' ', ' ', @in);
-
- if ($back eq $out) {
- print "ok $tn\n";
- } elsif ($rerun) {
- my $oi = $in;
- foreach ($in, $back, $out) {
- s/\t/^I\t/gs;
- s/\n/\$\n/gs;
- }
- print "------------ input2 ------------\n";
- print $in;
- print "\n------------ output2 -----------\n";
- print $back;
- print "\n------------ expected2 ---------\n";
- print $out;
- print "\n-------------------------------\n";
- $Text::Wrap::debug = 1;
- wrap(' ', ' ', $oi);
- exit(1);
- } else {
- print "not ok $tn\n";
- }
- $tn++;
-}
-
-$Text::Wrap::huge = 'overflow';
-
-my $tw = 'This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn';
-my $w = wrap('zzz','yyy',$tw);
-print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
-$tn++;
-
-{
- local $Text::Wrap::columns = 10;
- local $Text::Wrap::huge = "wrap";
- print ((wrap("verylongindent", "", "foo") eq "verylongindent\nfoo") ? "ok $tn\n" : "not ok $tn");
- $tn++;
-}
diff --git a/lib/Text/TabsWrap/t/wrap_separator2.t b/lib/Text/TabsWrap/t/wrap_separator2.t
deleted file mode 100644
index b31864fff5..0000000000
--- a/lib/Text/TabsWrap/t/wrap_separator2.t
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/local/bin/perl -w
-#Author: Dan Dascalescu
-use strict;
-use Test::More tests => 1;
-
-use Text::Wrap;
-
-local $Text::Wrap::columns = 15;
-local $Text::Wrap::separator2 = '[N]';
-
-is(wrap('','','some long text here that should be wrapped on at least three lines'),
-"some long text[N]here that[N]should be[N]wrapped on at[N]least three[N]lines",
-'If you just to preserve existing newlines but add new breaks with something else, set $Text::Wrap::separator2 instead.');
diff --git a/lib/Text/Wrap.pm b/lib/Text/Wrap.pm
deleted file mode 100644
index de8620247f..0000000000
--- a/lib/Text/Wrap.pm
+++ /dev/null
@@ -1,265 +0,0 @@
-package Text::Wrap;
-
-use warnings::register;
-require Exporter;
-
-@ISA = qw(Exporter);
-@EXPORT = qw(wrap fill);
-@EXPORT_OK = qw($columns $break $huge);
-
-$VERSION = 2009.0305;
-
-use vars qw($VERSION $columns $debug $break $huge $unexpand $tabstop
- $separator $separator2);
-use strict;
-
-BEGIN {
- $columns = 76; # <= screen width
- $debug = 0;
- $break = '\s';
- $huge = 'wrap'; # alternatively: 'die' or 'overflow'
- $unexpand = 1;
- $tabstop = 8;
- $separator = "\n";
- $separator2 = undef;
-}
-
-use Text::Tabs qw(expand unexpand);
-
-sub wrap
-{
- my ($ip, $xp, @t) = @_;
-
- local($Text::Tabs::tabstop) = $tabstop;
- my $r = "";
- my $tail = pop(@t);
- my $t = expand(join("", (map { /\s+\z/ ? ( $_ ) : ($_, ' ') } @t), $tail));
- my $lead = $ip;
- my $nll = $columns - length(expand($xp)) - 1;
- if ($nll <= 0 && $xp ne '') {
- my $nc = length(expand($xp)) + 2;
- warnings::warnif "Increasing \$Text::Wrap::columns from $columns to $nc to accommodate length of subsequent tab";
- $columns = $nc;
- $nll = 1;
- }
- my $ll = $columns - length(expand($ip)) - 1;
- $ll = 0 if $ll < 0;
- my $nl = "";
- my $remainder = "";
-
- use re 'taint';
-
- pos($t) = 0;
- while ($t !~ /\G(?:$break)*\Z/gc) {
- if ($t =~ /\G([^\n]{0,$ll})($break|\n+|\z)/xmgc) {
- $r .= $unexpand
- ? unexpand($nl . $lead . $1)
- : $nl . $lead . $1;
- $remainder = $2;
- } elsif ($huge eq 'wrap' && $t =~ /\G([^\n]{$ll})/gc) {
- $r .= $unexpand
- ? unexpand($nl . $lead . $1)
- : $nl . $lead . $1;
- $remainder = defined($separator2) ? $separator2 : $separator;
- } elsif ($huge eq 'overflow' && $t =~ /\G([^\n]*?)($break|\n+|\z)/xmgc) {
- $r .= $unexpand
- ? unexpand($nl . $lead . $1)
- : $nl . $lead . $1;
- $remainder = $2;
- } elsif ($huge eq 'die') {
- die "couldn't wrap '$t'";
- } elsif ($columns < 2) {
- warnings::warnif "Increasing \$Text::Wrap::columns from $columns to 2";
- $columns = 2;
- return ($ip, $xp, @t);
- } else {
- die "This shouldn't happen";
- }
-
- $lead = $xp;
- $ll = $nll;
- $nl = defined($separator2)
- ? ($remainder eq "\n"
- ? "\n"
- : $separator2)
- : $separator;
- }
- $r .= $remainder;
-
- print "-----------$r---------\n" if $debug;
-
- print "Finish up with '$lead'\n" if $debug;
-
- $r .= $lead . substr($t, pos($t), length($t)-pos($t))
- if pos($t) ne length($t);
-
- print "-----------$r---------\n" if $debug;;
-
- return $r;
-}
-
-sub fill
-{
- my ($ip, $xp, @raw) = @_;
- my @para;
- my $pp;
-
- for $pp (split(/\n\s+/, join("\n",@raw))) {
- $pp =~ s/\s+/ /g;
- my $x = wrap($ip, $xp, $pp);
- push(@para, $x);
- }
-
- # if paragraph_indent is the same as line_indent,
- # separate paragraphs with blank lines
-
- my $ps = ($ip eq $xp) ? "\n\n" : "\n";
- return join ($ps, @para);
-}
-
-1;
-__END__
-
-=head1 NAME
-
-Text::Wrap - line wrapping to form simple paragraphs
-
-=head1 SYNOPSIS
-
-B<Example 1>
-
- use Text::Wrap;
-
- $initial_tab = "\t"; # Tab before first line
- $subsequent_tab = ""; # All other lines flush left
-
- print wrap($initial_tab, $subsequent_tab, @text);
- print fill($initial_tab, $subsequent_tab, @text);
-
- $lines = wrap($initial_tab, $subsequent_tab, @text);
-
- @paragraphs = fill($initial_tab, $subsequent_tab, @text);
-
-B<Example 2>
-
- use Text::Wrap qw(wrap $columns $huge);
-
- $columns = 132; # Wrap at 132 characters
- $huge = 'die';
- $huge = 'wrap';
- $huge = 'overflow';
-
-B<Example 3>
-
- use Text::Wrap;
-
- $Text::Wrap::columns = 72;
- print wrap('', '', @text);
-
-=head1 DESCRIPTION
-
-C<Text::Wrap::wrap()> is a very simple paragraph formatter. It formats a
-single paragraph at a time by breaking lines at word boundaries.
-Indentation is controlled for the first line (C<$initial_tab>) and
-all subsequent lines (C<$subsequent_tab>) independently. Please note:
-C<$initial_tab> and C<$subsequent_tab> are the literal strings that will
-be used: it is unlikely you would want to pass in a number.
-
-Text::Wrap::fill() is a simple multi-paragraph formatter. It formats
-each paragraph separately and then joins them together when it's done. It
-will destroy any whitespace in the original text. It breaks text into
-paragraphs by looking for whitespace after a newline. In other respects
-it acts like wrap().
-
-Both C<wrap()> and C<fill()> return a single string.
-
-=head1 OVERRIDES
-
-C<Text::Wrap::wrap()> has a number of variables that control its behavior.
-Because other modules might be using C<Text::Wrap::wrap()> it is suggested
-that you leave these variables alone! If you can't do that, then
-use C<local($Text::Wrap::VARIABLE) = YOURVALUE> when you change the
-values so that the original value is restored. This C<local()> trick
-will not work if you import the variable into your own namespace.
-
-Lines are wrapped at C<$Text::Wrap::columns> columns (default value: 76).
-C<$Text::Wrap::columns> should be set to the full width of your output
-device. In fact, every resulting line will have length of no more than
-C<$columns - 1>.
-
-It is possible to control which characters terminate words by
-modifying C<$Text::Wrap::break>. Set this to a string such as
-C<'[\s:]'> (to break before spaces or colons) or a pre-compiled regexp
-such as C<qr/[\s']/> (to break before spaces or apostrophes). The
-default is simply C<'\s'>; that is, words are terminated by spaces.
-(This means, among other things, that trailing punctuation such as
-full stops or commas stay with the word they are "attached" to.)
-Setting C<$Text::Wrap::break> to a regular expression that doesn't
-eat any characters (perhaps just a forward look-ahead assertion) will
-cause warnings.
-
-Beginner note: In example 2, above C<$columns> is imported into
-the local namespace, and set locally. In example 3,
-C<$Text::Wrap::columns> is set in its own namespace without importing it.
-
-C<Text::Wrap::wrap()> starts its work by expanding all the tabs in its
-input into spaces. The last thing it does it to turn spaces back
-into tabs. If you do not want tabs in your results, set
-C<$Text::Wrap::unexpand> to a false value. Likewise if you do not
-want to use 8-character tabstops, set C<$Text::Wrap::tabstop> to
-the number of characters you do want for your tabstops.
-
-If you want to separate your lines with something other than C<\n>
-then set C<$Text::Wrap::separator> to your preference. This replaces
-all newlines with C<$Text::Wrap::separator>. If you just want to
-preserve existing newlines but add new breaks with something else, set
-C<$Text::Wrap::separator2> instead.
-
-When words that are longer than C<$columns> are encountered, they
-are broken up. C<wrap()> adds a C<"\n"> at column C<$columns>.
-This behavior can be overridden by setting C<$huge> to
-'die' or to 'overflow'. When set to 'die', large words will cause
-C<die()> to be called. When set to 'overflow', large words will be
-left intact.
-
-Historical notes: 'die' used to be the default value of
-C<$huge>. Now, 'wrap' is the default value.
-
-=head1 EXAMPLES
-
-Code:
-
- print wrap("\t","",<<END);
- This is a bit of text that forms
- a normal book-style indented paragraph
- END
-
-Result:
-
- " This is a bit of text that forms
- a normal book-style indented paragraph
- "
-
-Code:
-
- $Text::Wrap::columns=20;
- $Text::Wrap::separator="|";
- print wrap("","","This is a bit of text that forms a normal book-style paragraph");
-
-Result:
-
- "This is a bit of|text that forms a|normal book-style|paragraph"
-
-=head1 SEE ALSO
-
-For wrapping multi-byte characters: L<Text::WrapI18N>.
-For more detailed controls: L<Text::Format>.
-
-=head1 LICENSE
-
-David Muir Sharnoff <muir@idiom.org> with help from Tim Pierce and
-many many others. Copyright (C) 1996-2009 David Muir Sharnoff.
-This module may be modified, used, copied, and redistributed at
-your own risk. Publicly redistributed versions that are modified
-must use a different name.
-