Text::LineFold (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Text::LineFold - Line Folding for Plain TextSYNOPSIS
use Text::LineFold; $lf = Text::LineFold->new(); # Fold lines $folded = $lf->fold($string, 'PLAIN'); $indented = $lf->fold(' ' x 8, ' ' x 4, $string); # Unfold lines $unfolded = $lf->unfold($string, 'FIXED');
DESCRIPTION
Text::LineFold folds or unfolds lines of plain text. As it mainly focuses on plain text e-mail messages,RFC 3676
flowed format is also supported.
Public Interface
- new ([KEY=>VALUE, ...])
-
Constructor.
About KEY=>VALUEpairs see config method.
- $self->config (KEY)
- $self->config ([KEY=>VAL, ...])
-
Instance method.
Get or update configuration. Following KEY=>VALUEpairs may be specified.
-
- Charset => CHARSET
- Character set that is used to encode string. It may be string or MIME::Charset object. Default is "UTF-8".
- Language => LANGUAGE
- Along with Charset option, this may be used to define language/region context. Default is "XX". See also ``Context'' in Unicode::LineBreak option.
- Newline => STRING
- String to be used for newline sequence. Default is "\n".
- OutputCharset => CHARSET
- Character set that is used to encode result of fold()/unfold(). It may be string or MIME::Charset object. If a special value "_UNICODE_" is specified, result will be Unicode string. Default is the value of Charset option.
- TabSize => NUMBER
- Column width of tab stops. When 0 is specified, tab stops are ignored. Default is 8.
- BreakIndent
- CharMax
- ColMax
- ColMin
- ComplexBreaking
- EAWidth
- HangulAsAL
- LBClass
- LegacyCM
- Prep
- Urgent
- See ``Options'' in Unicode::LineBreak.
- Charset =>
-
- $self->fold (STRING,[METHOD])
- $self->fold (INITIAL_TAB, SUBSEQUENT_TAB, STRING, ...)
-
Instance method.
fold() folds lines of string STRINGand returns it. Surplus SPACEs and horizontal tabs at end of line are removed, newline sequences are replaced by that specified by Newline option and newline is appended at end of text if it does not exist. Horizontal tabs are treated as tab stops according to TabSize option.
By the first style, following options may be specified for
METHODargument.-
- FIXED
- Lines preceded by ">" won't be folded. Paragraphs are separated by empty line.
- FLOWED
-
"Format=Flowed; DelSp=Yes" formatting defined by RFC 3676.
- PLAIN
- Default method. All lines are folded.
-
Second style is similar to ``wrap()'' in Text::Wrap. All lines are folded.
INITIAL_TABis inserted at beginning of paragraphs andSUBSEQUENT_TABat beginning of other broken lines.
-
- $self->unfold (STRING, METHOD)
-
Conjunct folded paragraphs of string STRINGand returns it.
Following options may be specified for
METHODargument.-
- FIXED
- Default method. Lines preceded by ">" won't be conjuncted. Treat empty line as paragraph separator.
- FLOWED
-
Unfold "Format=Flowed; DelSp=Yes" formatting defined by RFC 3676.
- FLOWEDSP
-
Unfold "Format=Flowed; DelSp=No" formatting defined by RFC 3676.
-
BUGS
Please report bugs or buggy behaviors to developer.
CPAN
Request Tracker:
<rt.cpan.org/Public/Dist/Display.html?Name=Unicode-LineBreak>.
VERSION
Consult $VERSION variable.SEE ALSO
Unicode::LineBreak, Text::Wrap.AUTHOR
Copyright (C) 2009-2012 Hatuka*nezumi -IKEDA
Soji <hatuka(at)nezumi.nu>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.