| 1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
| 2 | .\" |
| 3 | .\" Standard preamble: |
| 4 | .\" ======================================================================== |
| 5 | .de Sh \" Subsection heading |
| 6 | .br |
| 7 | .if t .Sp |
| 8 | .ne 5 |
| 9 | .PP |
| 10 | \fB\\$1\fR |
| 11 | .PP |
| 12 | .. |
| 13 | .de Sp \" Vertical space (when we can't use .PP) |
| 14 | .if t .sp .5v |
| 15 | .if n .sp |
| 16 | .. |
| 17 | .de Vb \" Begin verbatim text |
| 18 | .ft CW |
| 19 | .nf |
| 20 | .ne \\$1 |
| 21 | .. |
| 22 | .de Ve \" End verbatim text |
| 23 | .ft R |
| 24 | .fi |
| 25 | .. |
| 26 | .\" Set up some character translations and predefined strings. \*(-- will |
| 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 28 | .\" double quote, and \*(R" will give a right double quote. | will give a |
| 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
| 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
| 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. |
| 32 | .tr \(*W-|\(bv\*(Tr |
| 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 34 | .ie n \{\ |
| 35 | . ds -- \(*W- |
| 36 | . ds PI pi |
| 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 39 | . ds L" "" |
| 40 | . ds R" "" |
| 41 | . ds C` "" |
| 42 | . ds C' "" |
| 43 | 'br\} |
| 44 | .el\{\ |
| 45 | . ds -- \|\(em\| |
| 46 | . ds PI \(*p |
| 47 | . ds L" `` |
| 48 | . ds R" '' |
| 49 | 'br\} |
| 50 | .\" |
| 51 | .\" If the F register is turned on, we'll generate index entries on stderr for |
| 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
| 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
| 54 | .\" output yourself in some meaningful fashion. |
| 55 | .if \nF \{\ |
| 56 | . de IX |
| 57 | . tm Index:\\$1\t\\n%\t"\\$2" |
| 58 | .. |
| 59 | . nr % 0 |
| 60 | . rr F |
| 61 | .\} |
| 62 | .\" |
| 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 64 | .\" way too many mistakes in technical documents. |
| 65 | .hy 0 |
| 66 | .if n .na |
| 67 | .\" |
| 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
| 70 | . \" fudge factors for nroff and troff |
| 71 | .if n \{\ |
| 72 | . ds #H 0 |
| 73 | . ds #V .8m |
| 74 | . ds #F .3m |
| 75 | . ds #[ \f1 |
| 76 | . ds #] \fP |
| 77 | .\} |
| 78 | .if t \{\ |
| 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 80 | . ds #V .6m |
| 81 | . ds #F 0 |
| 82 | . ds #[ \& |
| 83 | . ds #] \& |
| 84 | .\} |
| 85 | . \" simple accents for nroff and troff |
| 86 | .if n \{\ |
| 87 | . ds ' \& |
| 88 | . ds ` \& |
| 89 | . ds ^ \& |
| 90 | . ds , \& |
| 91 | . ds ~ ~ |
| 92 | . ds / |
| 93 | .\} |
| 94 | .if t \{\ |
| 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 101 | .\} |
| 102 | . \" troff and (daisy-wheel) nroff accents |
| 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 110 | .ds ae a\h'-(\w'a'u*4/10)'e |
| 111 | .ds Ae A\h'-(\w'A'u*4/10)'E |
| 112 | . \" corrections for vroff |
| 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 115 | . \" for low resolution devices (crt and lpr) |
| 116 | .if \n(.H>23 .if \n(.V>19 \ |
| 117 | \{\ |
| 118 | . ds : e |
| 119 | . ds 8 ss |
| 120 | . ds o a |
| 121 | . ds d- d\h'-1'\(ga |
| 122 | . ds D- D\h'-1'\(hy |
| 123 | . ds th \o'bp' |
| 124 | . ds Th \o'LP' |
| 125 | . ds ae ae |
| 126 | . ds Ae AE |
| 127 | .\} |
| 128 | .rm #[ #] #H #V #F C |
| 129 | .\" ======================================================================== |
| 130 | .\" |
| 131 | .IX Title "Text::Wrap 3" |
| 132 | .TH Text::Wrap 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide" |
| 133 | .SH "NAME" |
| 134 | Text::Wrap \- line wrapping to form simple paragraphs |
| 135 | .SH "SYNOPSIS" |
| 136 | .IX Header "SYNOPSIS" |
| 137 | \&\fBExample 1\fR |
| 138 | .PP |
| 139 | .Vb 1 |
| 140 | \& use Text::Wrap |
| 141 | .Ve |
| 142 | .PP |
| 143 | .Vb 2 |
| 144 | \& $initial_tab = "\et"; # Tab before first line |
| 145 | \& $subsequent_tab = ""; # All other lines flush left |
| 146 | .Ve |
| 147 | .PP |
| 148 | .Vb 2 |
| 149 | \& print wrap($initial_tab, $subsequent_tab, @text); |
| 150 | \& print fill($initial_tab, $subsequent_tab, @text); |
| 151 | .Ve |
| 152 | .PP |
| 153 | .Vb 1 |
| 154 | \& $lines = wrap($initial_tab, $subsequent_tab, @text); |
| 155 | .Ve |
| 156 | .PP |
| 157 | .Vb 1 |
| 158 | \& @paragraphs = fill($initial_tab, $subsequent_tab, @text); |
| 159 | .Ve |
| 160 | .PP |
| 161 | \&\fBExample 2\fR |
| 162 | .PP |
| 163 | .Vb 1 |
| 164 | \& use Text::Wrap qw(wrap $columns $huge); |
| 165 | .Ve |
| 166 | .PP |
| 167 | .Vb 4 |
| 168 | \& $columns = 132; # Wrap at 132 characters |
| 169 | \& $huge = 'die'; |
| 170 | \& $huge = 'wrap'; |
| 171 | \& $huge = 'overflow'; |
| 172 | .Ve |
| 173 | .PP |
| 174 | \&\fBExample 3\fR |
| 175 | .PP |
| 176 | .Vb 1 |
| 177 | \& use Text::Wrap |
| 178 | .Ve |
| 179 | .PP |
| 180 | .Vb 2 |
| 181 | \& $Text::Wrap::columns = 72; |
| 182 | \& print wrap('', '', @text); |
| 183 | .Ve |
| 184 | .SH "DESCRIPTION" |
| 185 | .IX Header "DESCRIPTION" |
| 186 | \&\f(CW\*(C`Text::Wrap::wrap()\*(C'\fR is a very simple paragraph formatter. It formats a |
| 187 | single paragraph at a time by breaking lines at word boundries. |
| 188 | Indentation is controlled for the first line (\f(CW$initial_tab\fR) and |
| 189 | all subsequent lines (\f(CW$subsequent_tab\fR) independently. Please note: |
| 190 | \&\f(CW$initial_tab\fR and \f(CW$subsequent_tab\fR are the literal strings that will |
| 191 | be used: it is unlikley you would want to pass in a number. |
| 192 | .PP |
| 193 | \&\fIText::Wrap::fill()\fR is a simple multi-paragraph formatter. It formats |
| 194 | each paragraph separately and then joins them together when it's done. It |
| 195 | will destroy any whitespace in the original text. It breaks text into |
| 196 | paragraphs by looking for whitespace after a newline. In other respects |
| 197 | it acts like \fIwrap()\fR. |
| 198 | .SH "OVERRIDES" |
| 199 | .IX Header "OVERRIDES" |
| 200 | \&\f(CW\*(C`Text::Wrap::wrap()\*(C'\fR has a number of variables that control its behavior. |
| 201 | Because other modules might be using \f(CW\*(C`Text::Wrap::wrap()\*(C'\fR it is suggested |
| 202 | that you leave these variables alone! If you can't do that, then |
| 203 | use \f(CW\*(C`local($Text::Wrap::VARIABLE) = YOURVALUE\*(C'\fR when you change the |
| 204 | values so that the original value is restored. This \f(CW\*(C`local()\*(C'\fR trick |
| 205 | will not work if you import the variable into your own namespace. |
| 206 | .PP |
| 207 | Lines are wrapped at \f(CW$Text::Wrap::columns\fR columns. \f(CW$Text::Wrap::columns\fR |
| 208 | should be set to the full width of your output device. In fact, |
| 209 | every resulting line will have length of no more than \f(CW\*(C`$columns \- 1\*(C'\fR. |
| 210 | .PP |
| 211 | It is possible to control which characters terminate words by |
| 212 | modifying \f(CW$Text::Wrap::break\fR. Set this to a string such as |
| 213 | \&\f(CW'[\es:]'\fR (to break before spaces or colons) or a pre-compiled regexp |
| 214 | such as \f(CW\*(C`qr/[\es']/\*(C'\fR (to break before spaces or apostrophes). The |
| 215 | default is simply \f(CW'\es'\fR; that is, words are terminated by spaces. |
| 216 | (This means, among other things, that trailing punctuation such as |
| 217 | full stops or commas stay with the word they are \*(L"attached\*(R" to.) |
| 218 | .PP |
| 219 | Beginner note: In example 2, above \f(CW$columns\fR is imported into |
| 220 | the local namespace, and set locally. In example 3, |
| 221 | \&\f(CW$Text::Wrap::columns\fR is set in its own namespace without importing it. |
| 222 | .PP |
| 223 | \&\f(CW\*(C`Text::Wrap::wrap()\*(C'\fR starts its work by expanding all the tabs in its |
| 224 | input into spaces. The last thing it does it to turn spaces back |
| 225 | into tabs. If you do not want tabs in your results, set |
| 226 | \&\f(CW$Text::Wrap::unexpand\fR to a false value. Likewise if you do not |
| 227 | want to use 8\-character tabstops, set \f(CW$Text::Wrap::tabstop\fR to |
| 228 | the number of characters you do want for your tabstops. |
| 229 | .PP |
| 230 | If you want to separate your lines with something other than \f(CW\*(C`\en\*(C'\fR |
| 231 | then set \f(CW$Text::Wrap::separator\fR to your preference. This replaces |
| 232 | all newlines with \f(CW$Text::Wrap::separator\fR. If you just to preserve |
| 233 | existing newlines but add new breaks with something else, set |
| 234 | \&\f(CW$Text::Wrap::separator2\fR instead. |
| 235 | .PP |
| 236 | When words that are longer than \f(CW$columns\fR are encountered, they |
| 237 | are broken up. \f(CW\*(C`wrap()\*(C'\fR adds a \f(CW"\en"\fR at column \f(CW$columns\fR. |
| 238 | This behavior can be overridden by setting \f(CW$huge\fR to |
| 239 | \&'die' or to 'overflow'. When set to 'die', large words will cause |
| 240 | \&\f(CW\*(C`die()\*(C'\fR to be called. When set to 'overflow', large words will be |
| 241 | left intact. |
| 242 | .PP |
| 243 | Historical notes: 'die' used to be the default value of |
| 244 | \&\f(CW$huge\fR. Now, 'wrap' is the default value. |
| 245 | .SH "EXAMPLE" |
| 246 | .IX Header "EXAMPLE" |
| 247 | .Vb 2 |
| 248 | \& print wrap("\et","","This is a bit of text that forms |
| 249 | \& a normal book-style paragraph"); |
| 250 | .Ve |
| 251 | .SH "LICENSE" |
| 252 | .IX Header "LICENSE" |
| 253 | David Muir Sharnoff <muir@idiom.com> with help from Tim Pierce and |
| 254 | many many others. Copyright (C) 1996\-2002 David Muir Sharnoff. |
| 255 | This module may be modified, used, copied, and redistributed at |
| 256 | your own risk. Publicly redistributed modified versions must use |
| 257 | a different name. |