{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Message::Body::Construct (perldoc)\n\n## NAME\n\nMail::Message::Body::Construct - adds functionality to Mail::Message::Body\n\n## DESCRIPTION\n\nThis package adds complex functionality to the Mail::Message::Body class. This functions less\noften used, so many programs will not compile this package.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (1 subsections)\n- **SEE ALSO**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Message::Body::Construct",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Message::Body::Construct - adds functionality to Mail::Message::Body",
        "synopsis": "",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructing a body",
                        "lines": 101
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Message::Body::Construct - adds functionality to Mail::Message::Body\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This package adds complex functionality to the Mail::Message::Body class. This functions less\noften used, so many programs will not compile this package.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructing a body",
                        "content": "$obj->attach($messages, %options)\nMake a multipart containing this body and the specified $messages. The options are passed to\nthe constructor of the multi-part body. If you need more control, create the multi-part body\nyourself. At least take a look at Mail::Message::Body::Multipart.\n\nThe message-parts will be coerced into a Mail::Message::Part, so you may attach\nMail::Internet or MIME::Entity objects if you want --see Mail::Message::coerce(). A new body\nwith attached messages is returned.\n\nexample:\n\nmy $pgpkey = Mail::Message::Body::File->new(file => 'a.pgp');\nmy $msg    = Mail::Message->buildFromBody(\n$message->decoded->attach($pgpkey));\n\n# The last message of the $multi multiparted body becomes a coerced $entity.\nmy $entity  = MIME::Entity->new;\nmy $multi   = $msg->body->attach($entity);\n\n# Now create a new message\nmy $msg     = Mail::Message->new(head => ..., body => $multi);\n\n$obj->concatenate($components)\nConcatenate a list of elements into one new body.\n\nSpecify a list of text $components. Each component can be a message (Mail::Message, the body\nof the message is used), a plain body (Mail::Message::Body), \"undef\" (which will be\nskipped), a scalar (which is split into lines), or an array of scalars (each providing one\nline).\n\nexample:\n\n# all arguments are Mail::Message::Body's.\nmy $sum = $body->concatenate($preamble, $body, $epilogue, \"-- \\n\" , $sig);\n\n$obj->foreachLine(CODE)\nCreate a new body by performing an action on each of its lines. If none of the lines change,\nthe current body will be returned, otherwise a new body is created of the same type as the\ncurrent.\n\nThe CODE refers to a subroutine which is called, where $ contains body's original line. DO\nNOT CHANGE $!!! The result of the routine is taken as new line. When the routine returns\n\"undef\", the line will be skipped.\n\nexample:\n\nmy $content  = $msg->decoded;\nmy $reply    = $content->foreachLine( sub { '> '.$ } );\nmy $rev      = $content->foreachLine( sub {reverse} );\n\nsub filled() { length $ > 1 ? $ : undef }\nmy $nonempty = $content->foreachLine( \\&filled );\n\nmy $wrong    = $content->foreachLine( sub {s/a/A/} );  # WRONG!!!\nmy $right    = $content->foreachLine(\nsub {(my $x=$) =~ s/a/A/; $x} );\n\n$obj->stripSignature(%options)\nStrip the signature from the body. The body must already be decoded otherwise the wrong\nlines may get stripped. Returned is the stripped version body, and in list context also the\nsignature, encapsulated in its own body object. The signature separator is the first line of\nthe returned signature body.\n\nThe signature is added by the sender to tell about him- or herself. It is superfluous in\nsome situations, for instance if you want to create a reply to the person's message you do\nnot need to include that signature.\n\nIf the body had no signature, the original body object is returned, and \"undef\" for the\nsignature body.\n\n-Option     --Default\nmaxlines    10\npattern      qr/^--\\s?$/\nresulttype  <same as current>\n\nmaxlines => INTEGER|undef\nThe maximum number of lines which can be the length of a signature. Specify \"undef\" to\nremove the limit.\n\npattern => REGEX|STRING|CODE\nWhich pattern defines the line which indicates the separator between the message and the\nsignature. In case of a STRING, this is matched to the beginning of the line, and REGEX is\na full regular expression.\n\nIn case of CODE, each line (from last to front) is passed to the specified subroutine as\nfirst argument. The subroutine must return TRUE when the separator is found.\n\nresulttype => CLASS\nThe type of body to be created for the stripped body (and maybe also to contain the\nstripped signature)\n\nexample:\n\nmy $start = $message->decoded;\nmy $start = $body->decoded;\n\nmy $stripped = $start->stripSignature;\n\nmy ($stripped, $sign) = $start->stripSignature\n(maxlines => 5, pattern => '-*-*-');\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "This module is part of Mail-Message distribution version 3.012, built on February 11, 2022.\nWebsite: http://perl.overmeer.net/CPAN/\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
                "subsections": []
            }
        }
    }
}