POD2::J...ineFold(3)

🌸 NAME 🌸

Text::LineFold~[ja] - プレインテキストの行折り (plain-text line folding). Bestie, this is the POD2::J...ineFold(3) page in the User Contributed Perl Documentation set. 💖

✨ SYNOPSIS ✨

Lowkey the whole plot in one code block:

use Text::LineFold;
$lf = Text::LineFold->new();

# 行折りする
$folded = $lf->fold($string, 'PLAIN');
$indented = $lf->fold(' ' x 8, ' ' x 4, $string);

# 行折りを戻す
$unfolded = $lf->unfold($string, 'FIXED');

💖 DESCRIPTION 💖

Okay so Text::LineFold is literally here to fold plain-text lines and unfold them back. It’s primarily aimed at email messages, and it also supports RFC 3676’s flowed format. I’m obsessed. No cap. 💅

🧚 公開インタフェース 🧚

  • new ([KEY => VALUE, ...]) — the constructor. For the KEY => VALUE pairs, peep the config method. 💖
  • $self->config (KEY)
  • $self->config ([KEY => VAL, ...]) — instance method. Gets or updates settings. These are the KEY => VALUE pairs you can pass:
    • Charset => CHARSET — the character set that the input string is encoded in. It can be a string or a MIME::Charset~[ja] object. Initial value is "UTF-8". ✨
    • Language => LANGUAGE — together with the Charset option, this can be used to determine language/region context. Initial value is "XX". Also see the "Context" in Unicode::LineBreak~[ja] option. 🌍
    • Newline => STRING — the newline string. Initial value is "\n". 🎀
    • OutputCharset => CHARSET — the character set to encode the result of fold()/unfold() in. It can be a string or a MIME::Charset~[ja] object. If you pass the special value "_UNICODE_", the result becomes a Unicode string. Initial value is the value of the Charset option. 🦋
    • TabSize => NUMBER — the number of columns for tab stops. If you set 0, tab stops are ignored. Initial value is 8. 📏
    • BreakIndent — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • CharMax — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • ColMax — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • ColMin — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • ComplexBreaking — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • EAWidth — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • HangulAsAL — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • LBClass — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • LegacyCM — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • Prep — see "オプション" in Unicode::LineBreak~[ja]. 🔥
    • Urgent — see "オプション" in Unicode::LineBreak~[ja]. 🔥
  • $self->fold (STRING, [METHOD])
  • $self->fold (INITIAL_TAB, SUBSEQUENT_TAB, STRING, ...) — instance method. It folds the string STRING. It removes extra whitespace characters and horizontal tab characters at line ends, replaces the newline string with the one set by the Newline option, and adds a newline at the end of the text if there isn’t one already. Horizontal tab characters are treated as tab stops with the width from the TabSize option. 🧵

In the first form, you can give the METHOD argument these options:

  • "FIXED" — lines starting with ">" are not folded. Paragraphs are separated by blank lines. 🛑
  • "FLOWED" — the RFC 3676-defined "Format=Flowed; DelSp=Yes" format. 🌊
  • "PLAIN" — the initial method. Folds all lines. 🎀

The second form is similar to "wrap()" in Text::Wrap. It folds all lines. It inserts INITIAL_TAB at the start of paragraphs, and SUBSEQUENT_TAB at the start of other lines. 🫶

  • $self->unfold (STRING, METHOD) — joins the folded paragraphs in string STRING back together and returns the result. 🧚

The METHOD argument can be:

  • "FIXED" — the initial method. Lines starting with ">" are not rejoined. Blank lines are treated as paragraph separators. 🛑
  • "FLOWED" — rejoins the RFC 3676-defined "Format=Flowed; DelSp=Yes" format. 🌊
  • "FLOWEDSP" — rejoins the RFC 3676-defined "Format=Flowed; DelSp=No" format. 🌊

💀 BUGS 💀

If you find bugs, or behavior that’s giving bug, highkey tell the developer. 🙈

CPAN Request Tracker: <http://rt.cpan.org/Public/Dist/Display.html?Name=Unicode-LineBreak>.

⭐ VERSION ⭐

Peep the $VERSION variable. Iconic. 👑

🌈 SEE ALSO 🌈

Unicode::LineBreak~[ja], 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.


💖 That’s the tea, bestie! This page is from perl v5.42.2, dated 2025-06-30, and it’s giving POD2::J...ineFold(3) main-character energy. Stay folded and fabulous! 🎀

📦 where this page comes from