{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Box::Parser (perldoc)\n\n## NAME\n\nMail::Box::Parser - reading and writing messages\n\n## SYNOPSIS\n\n# Not instatiatiated itself\n\n## DESCRIPTION\n\nThe \"Mail::Box::Parser\" manages the parsing of folders. Usually, you won't need to know anything\nabout this module, except the options which are involved with this code.\n\n## Sections\n\n- **NAME**\n- **INHERITANCE**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (6 subsections)\n- **DIAGNOSTICS**\n- **SEE ALSO**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Box::Parser",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Box::Parser - reading and writing messages",
        "synopsis": "# Not instatiatiated itself",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "INHERITANCE",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 28
                    },
                    {
                        "name": "The parser",
                        "lines": 23
                    },
                    {
                        "name": "Parsing",
                        "lines": 71
                    },
                    {
                        "name": "Internals",
                        "lines": 27
                    },
                    {
                        "name": "Error handling",
                        "lines": 41
                    },
                    {
                        "name": "Cleanup",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Box::Parser - reading and writing messages\n",
                "subsections": []
            },
            "INHERITANCE": {
                "content": "Mail::Box::Parser\nis a Mail::Reporter\n\nMail::Box::Parser is extended by\nMail::Box::Parser::C\nMail::Box::Parser::Perl\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "# Not instatiatiated itself\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The \"Mail::Box::Parser\" manages the parsing of folders. Usually, you won't need to know anything\nabout this module, except the options which are involved with this code.\n\nThere are two implementations of this module planned:\n\n*   Mail::Box::Parser::Perl\n\nA slower parser which only uses plain Perl. This module is a bit slower, and does less\nchecking and less recovery.\n\n*   Mail::Box::Parser::C\n\nA fast parser written in \"C\". This package is released as separate module on CPAN, because\nthe module distribution via CPAN can not handle XS files which are not located in the root\ndirectory of the module tree. If a C compiler is available on your system, it will be used\nautomatically.\n\nExtends \"DESCRIPTION\" in Mail::Reporter.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Extends \"METHODS\" in Mail::Reporter.\n",
                "subsections": [
                    {
                        "name": "Constructors",
                        "content": "Extends \"Constructors\" in Mail::Reporter.\n\nMail::Box::Parser->new(%options)\nCreate a parser object which can handle one file. For mbox-like mailboxes, this object can\nbe used to read a whole folder. In case of MH-like mailboxes, each message is contained in a\nsingle file, so each message has its own parser object.\n\n-Option  --Defined in     --Default\nfile                       undef\nfilename                   <required>\nlog       Mail::Reporter   'WARNINGS'\nmode                       'r'\ntrace     Mail::Reporter   'WARNINGS'\n\nfile => FILE-HANDLE\nAny \"IO::File\" or \"GLOB\" which can be used to read the data from. In case this option is\nspecified, the \"filename\" is informational only.\n\nfilename => FILENAME\nThe name of the file to be read.\n\nlog => LEVEL\nmode => OPENMODE\nFile-open mode, which defaults to 'r', which means `read-only'. See \"perldoc -f open\" for\npossible modes. Only applicable when no \"file\" is specified.\n\ntrace => LEVEL\n"
                    },
                    {
                        "name": "The parser",
                        "content": "$obj->fileChanged()\nReturns whether the file which is parsed has changed after the last time takeFileInfo() was\ncalled.\n\n$obj->filename()\nReturns the name of the file this parser is working on.\n\n$obj->restart()\nRestart the parser on a certain file, usually because the content has changed.\n\n$obj->start(%options)\nStart the parser by opening a file.\n\n-Option--Default\nfile    undef\n\nfile => FILEHANDLE|undef\nThe file is already open, for instance because the data must be read from STDIN.\n\n$obj->stop()\nStop the parser, which will include a close of the file. The lock on the folder will not be\nremoved (is not the responsibility of the parser).\n"
                    },
                    {
                        "name": "Parsing",
                        "content": "$obj->bodyAsFile( $fh [$chars, [$lines]] )\nTry to read one message-body from the file, and immediately write it to the specified\nfile-handle. Optionally, the predicted number of CHARacterS and/or $lines to be read can be\nsupplied. These values may be \"undef\" and may be wrong.\n\nThe return is a list of three scalars: the location of the body (begin and end) and the\nnumber of lines in the body.\n\n$obj->bodyAsList( [$chars, [$lines]] )\nTry to read one message-body from the file. Optionally, the predicted number of CHARacterS\nand/or $lines to be read can be supplied. These values may be \"undef\" and may be wrong.\n\nThe return is a list of scalars, each containing one line (including line terminator),\npreceded by two integers representing the location in the file where this body started and\nended.\n\n$obj->bodyAsString( [$chars, [$lines]] )\nTry to read one message-body from the file. Optionally, the predicted number of CHARacterS\nand/or $lines to be read can be supplied. These values may be \"undef\" and may be wrong.\n\nThe return is a list of three scalars, the location in the file where the body starts, where\nthe body ends, and the string containing the whole body.\n\n$obj->bodyDelayed( [$chars, [$lines]] )\nTry to read one message-body from the file, but the data is skipped. Optionally, the\npredicted number of CHARacterS and/or $lines to be skipped can be supplied. These values may\nbe \"undef\" and may be wrong.\n\nThe return is a list of four scalars: the location of the body (begin and end), the size of\nthe body, and the number of lines in the body. The number of lines may be \"undef\".\n\n$obj->filePosition( [$position] )\nReturns the location of the next byte to be used in the file which is parsed. When a\n$position is specified, the location in the file is moved to the indicated spot first.\n\n$obj->lineSeparator()\nReturns the character or characters which are used to separate lines in the folder file.\nThis is based on the first line of the file. UNIX systems use a single LF to separate lines.\nWindows uses a CR and a LF. Mac uses CR.\n\n$obj->popSeparator()\nRemove the last-pushed separator from the list which is maintained by the parser. This will\nreturn \"undef\" when there is none left.\n\n$obj->pushSeparator(STRING|Regexp)\nAdd a boundary line. Separators tell the parser where to stop reading. A famous separator is\nthe \"From\"-line, which is used in Mbox-like folders to separate messages. But also parts\n(*attachments*) is a message are divided by separators.\n\nThe specified STRING describes the start of the separator-line. The Regexp can specify a\nmore complicated format.\n\n$obj->readHeader()\nRead the whole message-header and return it as list of field-value pairs. Mind that some\nfields will appear more than once.\n\nThe first element will represent the position in the file where the header starts. The\nfollows the list of header field names and bodies.\n\nexample:\n\nmy ($where, @header) = $parser->readHeader;\n\n$obj->readSeparator(%options)\nRead the currently active separator (the last one which was pushed). The line (or \"undef\")\nis returned. Blank-lines before the separator lines are ignored.\n\nThe return are two scalars, where the first gives the location of the separator in the file,\nand the second the line which is found as separator. A new separator is activated using\npushSeparator().\n"
                    },
                    {
                        "name": "Internals",
                        "content": "$obj->closeFile()\nClose the file which was being parsed.\n\n$obj->defaultParserType( [$class] )\nMail::Box::Parser->defaultParserType( [$class] )\nReturns the parser to be used to parse all subsequent messages, possibly first setting the\nparser using the optional argument. Usually, the parser is autodetected; the \"C\"-based\nparser will be used when it can be, and the Perl-based parser will be used otherwise.\n\nThe $class argument allows you to specify a package name to force a particular parser to be\nused (such as your own custom parser). You have to \"use\" or \"require\" the package yourself\nbefore calling this method with an argument. The parser must be a sub-class of\n\"Mail::Box::Parser\".\n\n$obj->openFile($args)\nOpen the file to be parsed. $args is a ref-hash of options.\n\n-Option  --Default\nfilename  <required>\nmode      <required>\n\nfilename => FILENAME\nmode => STRING\n\n$obj->takeFileInfo()\nCapture some data about the file being parsed, to be compared later.\n"
                    },
                    {
                        "name": "Error handling",
                        "content": "Extends \"Error handling\" in Mail::Reporter.\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::Box::Parser->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $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::Box::Parser->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Box::Parser->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::Reporter.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                    }
                ]
            },
            "DIAGNOSTICS": {
                "content": "Warning: File $filename changed during access.\nWhen a message parser starts working, it takes size and modification time of the file at\nhand. If the folder is written, it checks whether there were changes in the file made by\nexternal programs.\n\nCalling Mail::Box::update() on a folder before it being closed will read these new messages.\nBut the real source of this problem is locking: some external program (for instance the mail\ntransfer agent, like sendmail) uses a different locking mechanism as you do and therefore\nviolates your rights.\n\nError: Filename or handle required to create a parser.\nA message parser needs to know the source of the message at creation. These sources can be a\nfilename (string), file handle object or GLOB. See new(filename) and new(file).\n\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": []
            }
        }
    }
}