{
    "mode": "perldoc",
    "parameter": "Mail::Message::Replace::MailHeader",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3AMessage%3A%3AReplace%3A%3AMailHeader/json",
    "generated": "2026-06-16T03:35:07Z",
    "synopsis": "!!! ALPHA CODE !!!\n# change\nuse Mail::Internet;\nuse Mail::Header;\n# into\nuse Mail::Message::Replace::MailInternet;\n# in existing code, and the code should still work, but\n# with the Mail::Message features.",
    "sections": {
        "NAME": {
            "content": "Mail::Message::Replace::MailHeader - fake Mail::Header\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Message::Replace::MailHeader\nis a Mail::Message::Head::Complete\nis a Mail::Message::Head\nis a Mail::Reporter\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "!!! ALPHA CODE !!!\n\n# change\nuse Mail::Internet;\nuse Mail::Header;\n# into\nuse Mail::Message::Replace::MailInternet;\n# in existing code, and the code should still work, but\n# with the Mail::Message features.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module is a wrapper around a Mail::Message::Head::Complete, which simulates a Mail::Header\nobject. The name-space of that module is hijacked and many methods are added.\n\nMost methods will work without any change, but you should test your software again. Small\nchanges have been made to foldlength(), headerhashref().\n\nExtends \"DESCRIPTION\" in Mail::Message::Head::Complete.\n",
            "subsections": []
        },
        "OVERLOADED": {
            "content": "Extends \"OVERLOADED\" in Mail::Message::Head::Complete.\n\noverload: \"\"\nInherited, see \"OVERLOADED\" in Mail::Message::Head\n\noverload: bool\nInherited, see \"OVERLOADED\" in Mail::Message::Head\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Message::Head::Complete.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Message::Head::Complete.\n\nMail::Message::Replace::MailHeader->build( [PAIR|$field], ... )\nInherited, see \"Constructors\" in Mail::Message::Head::Complete\n\n$obj->clone( [@names|ARRAY|Regexps] )\nInherited, see \"Constructors\" in Mail::Message::Head::Complete\n\nMail::Message::Replace::MailHeader->new( [$arg], %options )\nThe $arg is an array with header lines.\n\n-Option    --Defined in         --Default\nFoldLength                       79\nMailFrom                         'KEEP'\nModify                           <false>\nfieldtype  Mail::Message::Head  Mail::Message::Field::Fast\nlog         Mail::Reporter       'WARNINGS'\nmessage     Mail::Message::Head  undef\nmodified    Mail::Message::Head  <false>\ntrace       Mail::Reporter       'WARNINGS'\n\nFoldLength => INTEGER\nMailFrom => 'IGNORE'|'ERROR'|'COERCE'|'KEEP'\nHow to handle the \"From \" lines. See mailfrom().\n\nModify => BOOLEAN\nReformat all header lines when they come in: change the folding.\n\nfieldtype => CLASS\nlog => LEVEL\nmessage => MESSAGE\nmodified => BOOLEAN\ntrace => LEVEL\n"
                },
                {
                    "name": "The header",
                    "content": "Extends \"The header\" in Mail::Message::Head::Complete.\n\n$obj->isDelayed()\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->isEmpty()\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->isModified()\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->knownNames()\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->message( [$message] )\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->modified( [BOOLEAN] )\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->nrLines()\nInherited, see \"The header\" in Mail::Message::Head::Complete\n\n$obj->orderedFields()\nInherited, see \"The header\" in Mail::Message::Head\n\n$obj->size()\nInherited, see \"The header\" in Mail::Message::Head::Complete\n\n$obj->wrap($integer)\nInherited, see \"The header\" in Mail::Message::Head::Complete\n"
                },
                {
                    "name": "Access to the header",
                    "content": "Extends \"Access to the header\" in Mail::Message::Head::Complete.\n\n$obj->add( $line, [$index] )\nAdd a header line, which simply calls \"Mail::Message::Head::add()\" on the header for the\nspecified $line. The $index is ignored, the unfolded body of the field is returned.\n\n$obj->addListGroup($object)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->addResentGroup($resentgroup|$data)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->addSpamGroup($object)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->count($name)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->delete( $tag, [$index] )\nDelete the fields with the specified $tag. The deleted fields are returned. If no index is\ngiven, then all are removed.\n\n$obj->get( $name, [$index] )\nGet all the header fields with the specified $name. In scalar context, only the first\nfitting $name is returned. Even when only one $name is specified, multiple lines may be\nreturned in list context: some fields appear more than once in a header.\n\n$obj->grepNames( [@names|ARRAY|Regexps] )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->listGroup()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->names()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->print( [$fh] )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->printSelected($fh, <STRING|Regexp>, ...)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->printUndisclosed( [$fh] )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeContentInfo()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeField($field)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeFields( <STRING|Regexp>, ... )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeFieldsExcept( <STRING|Regexp>, ... )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeListGroup()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeResentGroups()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->removeSpamGroups()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->replace( $tag, $line, [$index] )\nReplace the field named $tag. from place $index (by default the first) by the $line. When\n$tag is \"undef\", it will be extracted from the $line first. This calls\nMail::Message::Head::Complete::reset() on the message's head.\n\n$obj->resentGroups()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->reset($name, @fields)\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->set( $field | $line | <$name, $body, [$attrs]> )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->spamDetected()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->spamGroups( [$names] )\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->string()\nInherited, see \"Access to the header\" in Mail::Message::Head::Complete\n\n$obj->study( $name, [$index] )\nInherited, see \"Access to the header\" in Mail::Message::Head\n"
                },
                {
                    "name": "About the body",
                    "content": "Extends \"About the body\" in Mail::Message::Head::Complete.\n\n$obj->guessBodySize()\nInherited, see \"About the body\" in Mail::Message::Head\n\n$obj->guessTimeStamp()\nInherited, see \"About the body\" in Mail::Message::Head::Complete\n\n$obj->isMultipart()\nInherited, see \"About the body\" in Mail::Message::Head\n\n$obj->recvstamp()\nInherited, see \"About the body\" in Mail::Message::Head::Complete\n\n$obj->timestamp()\nInherited, see \"About the body\" in Mail::Message::Head::Complete\n"
                },
                {
                    "name": "Internals",
                    "content": "Extends \"Internals\" in Mail::Message::Head::Complete.\n\n$obj->addNoRealize($field)\nInherited, see \"Internals\" in Mail::Message::Head\n\n$obj->addOrderedFields($fields)\nInherited, see \"Internals\" in Mail::Message::Head\n\n$obj->createFromLine()\nInherited, see \"Internals\" in Mail::Message::Head::Complete\n\n$obj->createMessageId()\nInherited, see \"Internals\" in Mail::Message::Head::Complete\n\n$obj->fileLocation()\nInherited, see \"Internals\" in Mail::Message::Head\n\n$obj->load()\nInherited, see \"Internals\" in Mail::Message::Head\n\n$obj->messageIdPrefix( [$prefix, [$hostname]|CODE] )\nMail::Message::Replace::MailHeader->messageIdPrefix( [$prefix, [$hostname]|CODE] )\nInherited, see \"Internals\" in Mail::Message::Head::Complete\n\n$obj->moveLocation($distance)\nInherited, see \"Internals\" in Mail::Message::Head\n\n$obj->setNoRealize($field)\nInherited, see \"Internals\" in Mail::Message::Head\n"
                },
                {
                    "name": "Error handling",
                    "content": "Extends \"Error handling\" in Mail::Message::Head::Complete.\n\n$obj->AUTOLOAD()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->addReport($object)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nMail::Message::Replace::MailHeader->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level,\n$callback] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->errors()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->log( [$level, [$strings]] )\nMail::Message::Replace::MailHeader->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Message::Replace::MailHeader->logPriority($level)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logSettings()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->notImplemented()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->report( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->reportAll( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->trace( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->warnings()\nInherited, see \"Error handling\" in Mail::Reporter\n"
                },
                {
                    "name": "Cleanup",
                    "content": "Extends \"Cleanup\" in Mail::Message::Head::Complete.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                },
                {
                    "name": "Access to the header",
                    "content": ""
                },
                {
                    "name": "Simulating Mail::Header",
                    "content": "$obj->asstring()\nReturns the whole header as one big scalar. Calls Mail::Message::Head::Complete::string().\n\n$obj->cleanup()\nCleanup memory usage. Not needed here.\n\n$obj->combine( $tag, [$with] )\nI do not see any valid reason for this command, so did not implement it.\n\n$obj->dup()\nDuplicate the header, which is simply clone().\n\n$obj->empty()\nClean-out the whole hash. Better not use this (simply create another header object),\nalthough it should work.\n\n$obj->exists()\nReturns whether there are any fields.\n\n$obj->extract(ARRAY)\nExtract (and remove) header fields from the array.\n\n$obj->fold( [$length] )\nRefold all fields in the header, to $length or whatever foldlength() returns.\n\n$obj->foldlength( [[$tag], $length] )\nReturns the line wrap, optionally after setting it to $length. The old value is returned.\nThe $tag argument is ignored, because it is silly to have different lines fold in different\nways. This method cannot be called statically anymore.\n\n$obj->header( [ARRAY] )\nExtract the fields from the ARRAY, if specified, and then fold the fields. Returned is an\narray with all fields, produced via orderedFields().\n\n$obj->headerhashref(HASH)\nIf you are using this method, you must be stupid... anyway: I do not want to support it for\nnow: use add() and friends.\n\n$obj->mailfrom( ['IGNORE'|'ERROR'|'COERCE'|'KEEP'] )\nWhat to do when a header line in the form `From ' is encountered. Valid values are \"IGNORE\"\n- ignore and discard the header, \"ERROR\" - invoke an error (call die), \"COERCE\" - rename\nthem as Mail-From and \"KEEP\" - keep them.\n\n$obj->modify( [BOOLEAN] )\nRefold the headers when they are added.\n\n$obj->read($file)\nRead the header from the $file.\n\n$obj->tags()\nReturns all the names of fields, implemented by Mail::Message::Head::Complete::names().\n\n$obj->unfold( [$tag] )\nRemove the folding for all instances of $tag, or all fields at once.\n"
                },
                {
                    "name": "The nasty bits",
                    "content": "$obj->isa($class)\nMail::Message::Replace::MailHeader->isa($class)\nOf course, the \"isa()\" class inheritance check should not see our nasty trick.\n"
                }
            ]
        },
        "DETAILS": {
            "content": "Extends \"DETAILS\" in Mail::Message::Head::Complete.\n",
            "subsections": []
        },
        "DIAGNOSTICS": {
            "content": "Warning: Cannot remove field $name from header: not found.\nYou ask to remove a field which is not known in the header. Using delete(), reset(), or\nset() to do the job will not result in warnings: those methods check the existence of the\nfield first.\n\nWarning: Field objects have an implied name ($name)\nError: Package $package does not implement $method.\nFatal error: the specific package (or one of its superclasses) does not implement this\nmethod where it should. This message means that some other related classes do implement this\nmethod however the class at hand does not. Probably you should investigate this and probably\ninform the author of the package.\n",
            "subsections": []
        },
        "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": []
        }
    },
    "summary": "Mail::Message::Replace::MailHeader - fake Mail::Header",
    "flags": [],
    "examples": [],
    "see_also": []
}