{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Box::Search::Grep (perldoc)\n\n## NAME\n\nMail::Box::Search::Grep - select messages within a mail box like grep does\n\n## SYNOPSIS\n\nuse Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\nmy $filter = Mail::Box::Search::Grep->new\n( label => 'selected'\n, in => 'BODY', match => qr/abc?d*e/\n);\nmy @msgs   = $filter->search($folder);\nmy $filter = Mail::Box::Search::Grep->new\n( field => 'To'\n, match => $myemail\n);\nif($filter->search($message)) {...}\n\n## DESCRIPTION\n\nTry to find some text strings in the header and footer of messages. Various ways to limit the\nsearch to certain header fields, the whole header, only the body, the whole message, but even\nbinary multiparts, are provided for.\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::Grep",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Box::Search::Grep - select messages within a mail box like grep does",
        "synopsis": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\nmy $filter = Mail::Box::Search::Grep->new\n( label => 'selected'\n, in => 'BODY', match => qr/abc?d*e/\n);\nmy @msgs   = $filter->search($folder);\nmy $filter = Mail::Box::Search::Grep->new\n( field => 'To'\n, match => $myemail\n);\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": 4,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 76
                    },
                    {
                        "name": "Searching",
                        "lines": 14
                    },
                    {
                        "name": "The Results",
                        "lines": 6
                    },
                    {
                        "name": "Error handling",
                        "lines": 41
                    },
                    {
                        "name": "Cleanup",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Box::Search::Grep - select messages within a mail box like grep does\n",
                "subsections": []
            },
            "INHERITANCE": {
                "content": "Mail::Box::Search::Grep\nis a Mail::Box::Search\nis a Mail::Reporter\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::Grep->new\n( label => 'selected'\n, in => 'BODY', match => qr/abc?d*e/\n);\n\nmy @msgs   = $filter->search($folder);\n\nmy $filter = Mail::Box::Search::Grep->new\n( field => 'To'\n, match => $myemail\n);\n\nif($filter->search($message)) {...}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Try to find some text strings in the header and footer of messages. Various ways to limit the\nsearch to certain header fields, the whole header, only the body, the whole message, but even\nbinary multiparts, are provided for.\n\nThe name *grep* is derived from the UNIX tool *grep*, which means: \"Get Regular Expression and\nPrint\". Although you can search using regular expressions (the Perl way of them), you do not\nhave to print those as result.\n\nExtends \"DESCRIPTION\" in Mail::Box::Search.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Extends \"METHODS\" in Mail::Box::Search.\n",
                "subsections": [
                    {
                        "name": "Constructors",
                        "content": "Extends \"Constructors\" in Mail::Box::Search.\n\nMail::Box::Search::Grep->new(%options)\nCreate a UNIX-grep like search filter.\n\n-Option    --Defined in       --Default\nbinaries    Mail::Box::Search  <false>\ndecode      Mail::Box::Search  <true>\ndelayed     Mail::Box::Search  <true>\ndeleted     Mail::Box::Search  <false>\ndeliver                        undef\nfield                          undef\nin          Mail::Box::Search  <$field ? 'HEAD' : C<'BODY'>>\nlabel       Mail::Box::Search  undef\nlimit       Mail::Box::Search  0\nlog         Mail::Reporter     'WARNINGS'\nlogical     Mail::Box::Search  'REPLACE'\nmatch                          <required>\nmultiparts  Mail::Box::Search  <true>\ntrace       Mail::Reporter     'WARNINGS'\n\nbinaries => BOOLEAN\ndecode => BOOLEAN\ndelayed => BOOLEAN\ndeleted => BOOLEAN\ndeliver => undef|CODE|'DELETE'|LABEL|'PRINT'|REF-ARRAY\nStore the details about where the match was found. The search may take much longer when\nthis feature is enabled.\n\nWhen an ARRAY is specified it will contain a list of references to hashes. Each hash\ncontains the information of one match. A match in a header line will result in a line with\nfields \"message\", \"part\", and \"field\", where the field is a Mail::Message::Field object.\nWhen the match is in the body the hash will contain a \"message\", \"part\", \"linenr\", and\n\"line\".\n\nIn case of a CODE reference, that routine is called for each match. The first argument is\nthis search object and the second a reference to same hash as would be stored in the\narray.\n\nThe \"PRINT\" will call printMatchedHead() or printMatchedBody() when any matching header\nresp body line was found. The output is minimized by not reprinting the message info on\nmultiple matches in the same message.\n\n\"DELETE\" will flag the message to be deleted in case of a match. When a multipart's part\nis matched, the whole message will be flagged for deletion.\n\nfield => undef|STRING|REGEX|CODE\nNot valid in combination with \"in\" set to \"BODY\". The STRING is one full field name\n(case-insensitive). Use a REGEX to select more than one header line to be scanned. CODE is\na routine which is called for each field in the header. The CODE is called with the header\nas first, and the field as second argument. If the CODE returns true, the message is\nselected.\n\nin => 'HEAD'|'BODY'|'MESSAGE'\nlabel => STRING\nlimit => NUMBER\nlog => LEVEL\nlogical => 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'\nmatch => STRING|REGEX|CODE\nThe pattern to be search for can be a REGular EXpression, or a STRING. In both cases, the\nmatch succeeds if it is found anywhere within the selected fields.\n\nWith a CODE reference, that function will be called each field or body-line. When the\nresult is true, the details are delivered. The call formats are\n\n$code->($head, $field);          # for HEAD searches\n$code->($body, $linenr, $line);  # for BODY searches\n\nThe $head resp $body are one message's head resp. body object. The $field is a header line\nwhich matches. The $line and $linenr tell the matching line in the body.\n\nBe warned that when you search in \"MESSAGE\" the code must accept both formats.\n\nmultiparts => BOOLEAN\ntrace => LEVEL\n"
                    },
                    {
                        "name": "Searching",
                        "content": "Extends \"Searching\" in Mail::Box::Search.\n\n$obj->inBody($part, $body)\nInherited, see \"Searching\" in Mail::Box::Search\n\n$obj->inHead($part, $head)\nInherited, see \"Searching\" in Mail::Box::Search\n\n$obj->search($folder|$thread|$message|ARRAY)\nInherited, see \"Searching\" in Mail::Box::Search\n\n$obj->searchPart($part)\nInherited, see \"Searching\" in Mail::Box::Search\n"
                    },
                    {
                        "name": "The Results",
                        "content": "Extends \"The Results\" in Mail::Box::Search.\n\n$obj->printMatch( [$fh], $match )\n$obj->printMatchedBody($fh, $match)\n$obj->printMatchedHead($fh, $match)\n"
                    },
                    {
                        "name": "Error handling",
                        "content": "Extends \"Error handling\" in Mail::Box::Search.\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::Grep->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::Grep->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Box::Search::Grep->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::Box::Search.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                    }
                ]
            },
            "DIAGNOSTICS": {
                "content": "Error: 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-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": []
            }
        }
    }
}