NAME
Text::LineFold - Line Folding for Plain Text
SYNOPSIS
use Text::LineFold;
$lf = Text::LineFold->new();
$folded = $lf->fold($string, 'PLAIN');
$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
- $self->config (KEY)
- $self->config ([KEY => VAL, ...])
-
Instance method. Get or update configuration. Following KEY => VALUE pairs may be specified.
- Charset => CHARSET
-
Character set that is used to encode string. It may be string or instance of 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. - OutputCharset => CHARSET
-
Character set that is used to encode result of fold()/unfold(). It may be string or instance of MIME::Charset object. If a special value
"_UNICODE_"
is specified, result will be Unicode string. Default is the value of Charset option. - CharactersMax
- ColumnsMin
- ColumnsMax
- HangulAsAL
- LegacyCM
- Newline
- SizingMethod
- TailorEA
- TailorLB
- UrgentBreaking
- UserBreaking
- $self->fold (STRING, METHOD)
-
Instance method. fold() folds lines of string STRING and returns it.
Following options may be specified for METHOD argument.
"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.
By any options, surplus SPACEs 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.
- $self->unfold (STRING, METHOD)
-
Conjunct folded paragraphs of string STRING and returns it.
Following options may be specified for METHOD argument.
BUGS
Please report bugs or buggy behaviors to developer. See "AUTHOR".
VERSION
Consult $VERSION variable.
Development versions of this module may be found at http://hatuka.nezumi.nu/repos/Unicode-LineBreak/.
SEE ALSO
Unicode::LineBreak, Text::Wrap.
AUTHOR
Copyright (C) 2009 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.