{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Box::Search (perldoc)\n\n## NAME\n\nMail::Box::Search - select messages within a mail box\n\n## SYNOPSIS\n\nuse Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\nmy $filter = Mail::Box::Search::[something]->new;\nmy @msgs   = $filter->search($folder, ...);\nif($filter->search($message)) {...}\n\n## DESCRIPTION\n\nThis \"Mail::Box::Search\" class is the base class for various message scan algorithms. The\nselected messages can be labeled. Boolean operations on messages are supported.\n\n## Sections\n\n- **NAME**\n- **INHERITANCE**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (5 subsections)\n- **DIAGNOSTICS**\n- **SEE ALSO**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Box::Search",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Box::Search - select messages within a mail box",
        "synopsis": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\nmy $filter = Mail::Box::Search::[something]->new;\nmy @msgs   = $filter->search($folder, ...);\nif($filter->search($message)) {...}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "INHERITANCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 75
                    },
                    {
                        "name": "Searching",
                        "lines": 35
                    },
                    {
                        "name": "The Results",
                        "lines": 5
                    },
                    {
                        "name": "Error handling",
                        "lines": 41
                    },
                    {
                        "name": "Cleanup",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Box::Search - select messages within a mail box\n",
                "subsections": []
            },
            "INHERITANCE": {
                "content": "Mail::Box::Search\nis a Mail::Reporter\n\nMail::Box::Search is extended by\nMail::Box::Search::Grep\nMail::Box::Search::SpamAssassin\nMail::Server::IMAP4::Search\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\n\nmy $filter = Mail::Box::Search::[something]->new;\nmy @msgs   = $filter->search($folder, ...);\nif($filter->search($message)) {...}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This \"Mail::Box::Search\" class is the base class for various message scan algorithms. The\nselected messages can be labeled. Boolean operations on messages are supported.\n\nCurrently implemented searches:\n\nMail::Box::Search::Grep\nMatch header or body against a regular expression in a UNIX \"grep\" like fashion.\n\nMail::Box::Search::SpamAssassin\nTry to detect spam, using Mail::SpamAssassin.\n\nMail::Box::Search::IMAP\nSearch an IMAP folder for special interface IMAP folders provide for it. UNDER CONSTRUCTION\ntill Mail::Transport::IMAP4 is complete.\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::Search->new(%options)\nCreate a filter.\n\n-Option    --Defined in     --Default\nbinaries                     <false>\ndecode                       <true>\ndelayed                      <true>\ndeleted                      <false>\ndeliver                      undef\nin                           'BODY'\nlabel                        undef\nlimit                        0\nlog         Mail::Reporter   'WARNINGS'\nlogical                      'REPLACE'\nmultiparts                   <true>\ntrace       Mail::Reporter   'WARNINGS'\n\nbinaries => BOOLEAN\nWhether to include binary bodies in the search.\n\ndecode => BOOLEAN\nDecode the messages before the search takes place. Even plain text messages can be\nencoded, for instance as \"quoted-printable\", which may disturb the results. However,\ndecoding will slow-down the search.\n\ndelayed => BOOLEAN\nInclude the delayed messages (which will be parsed) in the search. If you set this to\nfalse, you may find fewer hits.\n\ndeleted => BOOLEAN\nIn most cases, you will not be interested in results which are found in messages flagged\nto be deleted. However, with this option you can specify you want them to be searched too.\n\ndeliver => undef|CODE|'DELETE'\nThe exact functionality of this parameter differs per search method, so read the\napplicable man-page. In any case \"undef\" means that details are not collected for this\nsearch, which is the fastest search.\n\n\"DELETE\" will flag the message to be flagged for deletion. You may also specify your own\nCODE reference. With an reference to an array, the information about the matches is\ncollected as a list of hashes, one hash per match.\n\nin => 'HEAD'|'BODY'|'MESSAGE'\nWhere to look for the match.\n\nlabel => STRING\nMark all selected messages with the specified STRING. If this field is not specified, the\nmessage will not get a label; search() also returns a list of selected messages.\n\nlimit => NUMBER\nLimit the search to the specified NUMBER of messages. When the NUMBER is positive, the\nsearch starts at the first message in the folder or thread. A negative NUMBER starts at\nthe end of the folder. If the limit is set to zero, there is no limit.\n\nlog => LEVEL\nlogical => 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'\nOnly applicable in combination with a \"label\". How to handle the existing labels. In case\nof \"REPLACE\", messages which already are carrying the label are stripped from their\nselection (unless they match again). With \"AND\", the message must be selected by this\nsearch and already carry the label, otherwise the label will not be set. Specify \"OR\" to\nhave newly selected messages added to the set of already selected messages.\n\n\"NOT\" is true for messages which do not fulfil the search. The details output will still\ncontain the places where the match was found, however those messages will complementary\nset of messages will be labeled and returned.\n\nmultiparts => BOOLEAN\nAre multiparts to be included in the search results? Some MUA have problems handling\ndetails received from the search. When this flag is turned off, the body of multiparts\nwill be ignored. The parts search will include the preamble and epilogue.\n\ntrace => LEVEL\n"
                    },
                    {
                        "name": "Searching",
                        "content": "$obj->inBody($part, $body)\nTests whether body contains the requesting information. See the specific search module for\nits parameters.\n\n$obj->inHead($part, $head)\nTests whether header contains the requesting information. See the specific search module for\nits parameters.\n\n$obj->search($folder|$thread|$message|ARRAY)\nCheck which messages from the $folder (Mail::Box) match the search parameters. The matched\nmessages are returned as list. You can also specify a $thread (a Mail::Box::Thread::Node),\none single $message (a Mail::Message), or an ARRAY of messages.\n\nSometimes we know how only one match is needed. In this case, this searching will stop at\nthe first match. For instance, when \"limit\" is -1 or 1, or when the search in done in scalar\ncontext.\n\nexample:\n\nmy $grep = Mail::Box::Search::Grep->new\n( match   => 'My Name Is Nobody'\n, deliver => 'PRINT'\n);\n\n$grep->search($folder);\n\nmy $message = $folder->message(3);\n$grep->search($message);\n\nmy $thread  = $message->threadStart;\n$grep->search($thread);\n\n$obj->searchPart($part)\nSearch this message $part for matches.\n"
                    },
                    {
                        "name": "The Results",
                        "content": "$obj->printMatch( [$fh], HASH )\nPrint the information about the match (see new(deliver)) in some understandable way. If no\nfile handle is specified, the output will go to the selected filehandle (see \"perldoc -f\nselect\").\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::Search->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::Search->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Box::Search->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": "Error: Cannot search in body.\nTh search object does not implement inBody(), and can therefore not search a message body.\n\nError: Cannot search in header.\nTh search object does not implement inHead(), and can therefore not search a message header.\n\nError: Don't know how to deliver via results in $way.\nThe search results cannot be delivered in the specific way, because that is not a defined\nalternative.\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\nError: Search in BODY, HEAD or MESSAGE not $in.\nThe \"in\" option defines only three names.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "This module is part of Mail-Box distribution version 3.009, built on August 18, 2020. Website:\nhttp://perl.overmeer.net/CPAN/\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyrights 2001-2020 by [Mark Overmeer]. 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": []
            }
        }
    }
}