{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Header (perldoc)\n\n## NAME\n\nMail::Header - manipulate MIME headers\n\n## SYNOPSIS\n\nuse Mail::Header;\nmy $head = Mail::Header->new;\nmy $head = Mail::Header->new( \\*STDIN );\nmy $head = Mail::Header->new( [<>], Modify => 0);\n\n## DESCRIPTION\n\nRead, write, create, and manipulate MIME headers, the leading part of each modern e-mail\nmessage, but also used in other protocols like HTTP. The fields are kept in Mail::Field objects.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (3 subsections)\n- **SEE ALSO**\n- **AUTHORS**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Header",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Header - manipulate MIME headers",
        "synopsis": "use Mail::Header;\nmy $head = Mail::Header->new;\nmy $head = Mail::Header->new( \\*STDIN );\nmy $head = Mail::Header->new( [<>], Modify => 0);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 56
                    },
                    {
                        "name": "Accessors",
                        "lines": 19
                    },
                    {
                        "name": "Processing",
                        "lines": 55
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Header - manipulate MIME headers\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Mail::Header;\n\nmy $head = Mail::Header->new;\nmy $head = Mail::Header->new( \\*STDIN );\nmy $head = Mail::Header->new( [<>], Modify => 0);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Read, write, create, and manipulate MIME headers, the leading part of each modern e-mail\nmessage, but also used in other protocols like HTTP. The fields are kept in Mail::Field objects.\n\nBe aware that the header fields each have a name part, which shall be treated case-insensitive,\nand a content part, which may be folded over multiple lines.\n\nMail::Header does not always follow the RFCs strict enough, does not help you with character\nencodings. It does not use weak references where it could (because those did not exist when the\nmodule was written) which costs some performance and make the implementation a little more\ncomplicated. The Mail::Message::Head implementation is much newer and therefore better.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructors",
                        "content": "$obj->dup()\nCreate a duplicate of the current object.\n\n$obj->new( [$source], [%options] )\nMail::Header->new( [$source], [%options] )\nThe $source may be either a file descriptor (reference to a GLOB) or a reference to an\narray. If given the new object will be initialized with headers either from the array of\nread from the file descriptor.\n\n%options is a list of options given in the form of key-value pairs, just like a hash table.\nValid options are\n\n-Option    --Default\nFoldLength  79\nMailFrom    'KEEP'\nModify      false\n\nFoldLength => INTEGER\nThe default length of line to be used when folding header lines. See foldlength().\n\nMailFrom => 'IGNORE'|'COERCE'|'KEEP'|'ERROR'\nSee method mailfrom().\n\nModify => BOOLEAN\nIf this value is *true* then the headers will be re-formatted, otherwise the format of the\nheader lines will remain unchanged.\n\n\"Fake\" constructors\nBe warned that the next constructors all require an already created header object, of which the\noriginal content will be destroyed.\n\n$obj->empty()\nEmpty an existing \"Mail::Header\" object of all lines.\n\n$obj->extract(ARRAY)\nExtract a header from the given array into an existing Mail::Header object. \"extract\" will\nmodify this array. Returns the object that the method was called on.\n\n$obj->header( [ARRAY] )\n\"header\" does multiple operations. First it will extract a header from the ARRAY, if given.\nIt will then reformat the header (if reformatting is permitted), and finally return a\nreference to an array which contains the header in a printable form.\n\n$obj->headerhashref( [HASH] )\nAs header(), but it will eventually set headers from a hash reference, and it will return\nthe headers as a hash reference.\n\nexample:\n\n$fields->{From} = 'Tobias Brox <tobix@cpan.org>';\n$fields->{To}   = ['you@somewhere', 'me@localhost'];\n$head->headerhashref($fields);\n\n$obj->read($fh)\nRead a header from the given file descriptor into an existing Mail::Header object.\n"
                    },
                    {
                        "name": "Accessors",
                        "content": "$obj->foldlength( [$tag], [$length] )\nSet the default fold length for all tags or just one. With no arguments the default fold\nlength is returned. With two arguments it sets the fold length for the given tag and returns\nthe previous value. If only $length is given it sets the default fold length for the current\nobject.\n\nIn the two argument form \"foldlength\" may be called as a static method, setting default\nfold lengths for tags that will be used by all \"Mail::Header\" objects. See the \"fold\" method\nfor a description on how \"Mail::Header\" uses these values.\n\n$obj->mailfrom('IGNORE'|'COERCE'|'KEEP'|'ERROR')\nThis specifies what to do when a `From ' line is encountered. Valid values are \"IGNORE\" -\nignore and discard the header, \"ERROR\" - invoke an error (call die), \"COERCE\" - rename them\nas Mail-From and \"KEEP\" - keep them.\n\n$obj->modify( [$value] )\nIf $value is *false* then \"Mail::Header\" will not do any automatic reformatting of the\nheaders, other than to ensure that the line starts with the tags given.\n"
                    },
                    {
                        "name": "Processing",
                        "content": "$obj->add( $tag, $line [, $index] )\nAdd a new line to the header. If $tag is \"undef\" the tag will be extracted from the\nbeginning of the given line. If $index is given, the new line will be inserted into the\nheader at the given point, otherwise the new line will be appended to the end of the header.\n\n$obj->asstring()\nReturns the header as a single string.\n\n$obj->cleanup()\nRemove any header line that, other than the tag, only contains whitespace\n\n$obj->combine( $tag [, $with] )\nCombine all instances of $tag into one. The lines will be joined together $with, or a single\nspace if not given. The new item will be positioned in the header where the first instance\nwas, all other instances of $tag will be removed.\n\n$obj->count($tag)\nReturns the number of times the given atg appears in the header\n\n$obj->delete( $tag [, $index ] )\nDelete a tag from the header. If an $index id is given, then the Nth instance of the tag\nwill be removed. If no $index is given, then all instances of tag will be removed.\n\n$obj->fold( [$length] )\nFold the header. If $length is not given, then \"Mail::Header\" uses the following rules to\ndetermine what length to fold a line.\n\n$obj->get( $tag [, $index] )\nGet the text from a line. If an $index is given, then the text of the Nth instance will be\nreturned. If it is not given the return value depends on the context in which \"get\" was\ncalled. In an array context a list of all the text from all the instances of the $tag will\nbe returned. In a scalar context the text for the first instance will be returned.\n\nThe lines are unfolded, but still terminated with a new-line (see \"chomp\")\n\n$obj->print( [$fh] )\nPrint the header to the given file descriptor, or \"STDOUT\" if no file descriptor is given.\n\n$obj->replace( $tag, $line [, $index ] )\nReplace a line in the header. If $tag is \"undef\" the tag will be extracted from the\nbeginning of the given line. If $index is given the new line will replace the Nth instance\nof that tag, otherwise the first instance of the tag is replaced. If the tag does not appear\nin the header then a new line will be appended to the header.\n\n$obj->tags()\nReturns an array of all the tags that exist in the header. Each tag will only appear in the\nlist once. The order of the tags is not specified.\n\n$obj->unfold( [$tag] )\nUnfold all instances of the given tag so that they do not spread across multiple lines. If\n$tag is not given then all lines are unfolded.\n\nThe unfolding process is wrong but (for compatibility reasons) will not be repaired: only\none blank at the start of the line should be removed, not all of them.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance\nwithout commitment to further development.\n\nMail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>.\nMail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see\nChangeLog.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2017 Mark Overmeer\n<perl@overmeer.net>.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://www.perl.com/perl/misc/Artistic.html\n",
                "subsections": []
            }
        }
    }
}