Text::Wrapper(3pm) | User Contributed Perl Documentation | Text::Wrapper(3pm) |
NAME¶
Text::Wrapper - Word wrap text by breaking long lines
VERSION¶
This document describes version 1.05 of Text::Wrapper, released January 18, 2014.
SYNOPSIS¶
require Text::Wrapper; $wrapper = Text::Wrapper->new(columns => 60, body_start => ' '); print $wrapper->wrap($text); $wrapper->columns(70);
DESCRIPTION¶
Text::Wrapper provides simple word wrapping. It breaks long lines, but does not alter spacing or remove existing line breaks. If you're looking for more sophisticated text formatting, try the Text::Format module.
Reasons to use Text::Wrapper instead of Text::Format:
- Text::Wrapper is significantly smaller.
- It does not alter existing whitespace or combine short lines. It only breaks long lines.
Again, if Text::Wrapper doesn't meet your needs, try Text::Format.
ATTRIBUTES¶
body_start¶
The text that begins the second and following lines of a paragraph. (Default '')
columns¶
The number of columns to use. This includes any text in body_start or par_start. (Default 70)
par_start¶
The text that begins the first line of each paragraph. (Default '')
wrap_after¶
A line can wrap after any of the characters in this string. Setting this to the empty string means a line will wrap only at whitespace. (Default '-')
METHODS¶
wrap¶
$wrapper->wrap($text)
Returns a word wrapped copy of $text. The original is not altered.
CONFIGURATION AND ENVIRONMENT¶
Text::Wrapper requires no configuration files or environment variables.
DEPENDENCIES¶
None.
INCOMPATIBILITIES¶
None reported.
BUGS AND LIMITATIONS¶
Does not handle tabs (they're treated just like spaces).
All characters are treated as being the same width, including zero-width spaces and combining accents.
Does not break words that can't fit on one line.
AUTHOR¶
Christopher J. Madsen "<perl AT cjmweb.net>"
Please report any bugs or feature requests to "<bug-Text-Wrapper AT rt.cpan.org>" or through the web interface at <http://rt.cpan.org/Public/Bug/Report.html?Queue=Text-Wrapper>.
You can follow or contribute to Text-Wrapper's development at <https://github.com/madsen/text-wrapper>.
COPYRIGHT AND LICENSE¶
This software is copyright (c) 2014 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTY¶
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
2022-10-15 | perl v5.34.0 |