Text::Wrapper.3pm

Langue: en

Version: 2010-05-07 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Text::Wrapper - Simple word wrapping routine

VERSION

This document describes version 1.02 of Text::Wrapper, released May 10, 2008.

SYNOPSIS

     require Text::Wrapper;
     $wrapper = Text::Wrapper->new(columns => 60, body_start => '    ');
     print $wrapper->wrap($text);
 
 

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.

Methods

$wrapper = Text::Wrapper->new( [options] )
Constructs a new Text::Wrapper object. The options are specified by key and value. The keys are:
  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 '')
 
 
$wrapper->body_start( [$value] )
$wrapper->columns( [$value] )
$wrapper->par_start( [$value] )
If $value is supplied, sets the option and returns the previous value. If omitted, just returns the current value.
$wrapper->wrap($text)
Returns a word wrapped copy of $text. The original is not altered.

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

Does not handle tabs (they're treated just like spaces).

Does not break words that can't fit on one line.

AUTHOR

Christopher J. Madsen C<< <perl AT cjmweb.net> >>

Please report any bugs or feature requests to C<< <bug-Text-Wrapper AT rt.cpan.org> >>, or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=Text-Wrapper <http://rt.cpan.org/Public/Bug/Report.html?Queue=Text-Wrapper>

Copyright 1998 Christopher J. Madsen

Text::Wrapper is free software; you can redistribute it and/or modify it under the same terms as Perl 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 LICENCE, 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.