Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  TEXT::FLOWED (3)

.ds Aq ’


Text::Flowed - text formatting routines for RFC2646 format=flowed



 use Text::Flowed qw(reformat quote quote_fixed);

 print reformat($text, {
     quote => 1,
     fixed => 1,
     opt_length => 72,
     max_length => 79

 print quote($text);      # alias for quote => 1
 print quote_fixed(text); # alias for quote => 1, fixed => 1


This module provides functions that deals with formatting data with Content-Type ’text/plain; format=flowed’ as described in RFC2646 ( In a nutshell, format=flowed text solves the problem in plain text files where it is not known which lines can be considered a logical paragraph, enabling lines to be automatically flowed (wrapped and/or joined) as appropriate when displaying.

In format=flowed, a soft newline is expressed as \n, while hard newlines are expressed as \n. Soft newlines can be automatically deleted or inserted as appropriate when the text is reformatted.
<B>reformatB>($text [, \%args]) The reformat() function takes some format=flowed text as input, and reformats it. Paragraphs will be rewrapped to the optimum width, with lines being split or combined as necessary.

    my $formatted_text = reformat($text, \%args);

If <B>B>$args<B>->{quote}B> is true, a level of quoting will be added to the beginning of every line.

If <B>B>$args<B>->{fixed}B> is true, unquoted lines in $text will be interpreted as format=fixed (i.e. leading spaces are interpreted literally, and lines will not be joined together). (Set it to 2 to make all lines interpreted as format=fixed.) This is useful for processing messages posted in web-based forums, which are not format=flowed, but preserve paragraph structure due to paragraphs not having internal line breaks.

<B>B>$args<B>->{max_length}B> (default 79) is the maximum length of line that reformat() or quote() will generate. Any lines longer than this length will be rewrapped, unless there is an excessively long word that makes this impossible, in which case it will generate a long line containing only that word.

<B>B>$args<B>->{opt_length}B> (default 72) is the optimum line length. When reformat() or quote() rewraps a paragraph, the resulting lines will not exceed this length (except perhaps for excessively long words).

If a line exceeds opt_length but does not exceed max_length, it might not be rewrapped.

<B>quoteB>($text) quote($text) is an alias for reformat($text, {quote => 1}).

    my $quoted_text = quote($text);

<B>quote_fixedB>($text) quote_fixed($text) is an alias for reformat($text, {quote => 1, fixed => 1}).

    my $quoted_text = quote_fixed($text);


Copyright 2002-2003, Philip Mak

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 TEXT::FLOWED (3) 2002-08-15

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.