Text::WrapProp - proportional line wrapping to form simple paragraphs
use Text::WrapProp qw(wrap_prop); print wrap_prop($text, $width, $ref_width_table);
Text::WrapProp::wrap_prop() is a very simple paragraph formatter for proportional text. It formats a single paragraph at a time by breaking lines at word boundries. You must supply the column width in floating point units which should be set to the full width of your output device. A reference to a character width table must also be supplied. The width units can be any metric you choose, as long as the column width and the width table use the same metric.
Proportional wrapping is most commonly used in the publishing industry. In the HTML age, custom proportional wrapping is less often performed as the browser performs the calculations automatically.
use strict; use diagnostics; use Text::WrapProp qw(wrap_prop); my @width_table = 0.05 x 256; print wrap_prop("This is a bit of text that forms a normal book-style paragraph. Supercajafrajalisticexpialadocious!", 4.00, \@width_table);
It's not clear what the correct behavior should be when WrapProp() is presented with a word that is longer than a line. The previous behavior was to die. Now the word is split at line-length.
James Briggs <james.briggs@yahoo.com>. Styled after Text::Wrap.
To install Text::WrapProp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::WrapProp
CPAN shell
perl -MCPAN -e shell install Text::WrapProp
For more information on module installation, please visit the detailed CPAN module installation guide.