1Text::Wrapper(3) User Contributed Perl Documentation Text::Wrapper(3)
2
3
4
6 Text::Wrapper - Word wrap text by breaking long lines
7
9 This document describes version 1.05 of Text::Wrapper, released January
10 18, 2014.
11
13 require Text::Wrapper;
14 $wrapper = Text::Wrapper->new(columns => 60, body_start => ' ');
15 print $wrapper->wrap($text);
16 $wrapper->columns(70);
17
19 Text::Wrapper provides simple word wrapping. It breaks long lines, but
20 does not alter spacing or remove existing line breaks. If you're
21 looking for more sophisticated text formatting, try the Text::Format
22 module.
23
24 Reasons to use Text::Wrapper instead of Text::Format:
25
26 • Text::Wrapper is significantly smaller.
27
28 • It does not alter existing whitespace or combine short lines. It
29 only breaks long lines.
30
31 Again, if Text::Wrapper doesn't meet your needs, try Text::Format.
32
34 body_start
35 The text that begins the second and following lines of a paragraph.
36 (Default '')
37
38 columns
39 The number of columns to use. This includes any text in body_start or
40 par_start. (Default 70)
41
42 par_start
43 The text that begins the first line of each paragraph. (Default '')
44
45 wrap_after
46 A line can wrap after any of the characters in this string. Setting
47 this to the empty string means a line will wrap only at whitespace.
48 (Default '-')
49
51 wrap
52 $wrapper->wrap($text)
53
54 Returns a word wrapped copy of $text. The original is not altered.
55
57 Text::Wrapper requires no configuration files or environment variables.
58
60 None.
61
63 None reported.
64
66 Does not handle tabs (they're treated just like spaces).
67
68 All characters are treated as being the same width, including zero-
69 width spaces and combining accents.
70
71 Does not break words that can't fit on one line.
72
74 Christopher J. Madsen "<perl AT cjmweb.net>"
75
76 Please report any bugs or feature requests to
77 "<bug-Text-Wrapper AT rt.cpan.org>" or through the web interface at
78 <http://rt.cpan.org/Public/Bug/Report.html?Queue=Text-Wrapper>.
79
80 You can follow or contribute to Text-Wrapper's development at
81 <https://github.com/madsen/text-wrapper>.
82
84 This software is copyright (c) 2014 by Christopher J. Madsen.
85
86 This is free software; you can redistribute it and/or modify it under
87 the same terms as the Perl 5 programming language system itself.
88
90 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
91 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
92 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
93 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
94 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
95 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
96 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
97 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
98 NECESSARY SERVICING, REPAIR, OR CORRECTION.
99
100 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
101 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
102 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
103 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
104 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
105 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
106 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
107 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
108 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
109 DAMAGES.
110
111
112
113perl v5.32.1 2021-01-27 Text::Wrapper(3)