{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Box::Tie::ARRAY (perldoc)\n\n## NAME\n\nMail::Box::Tie::ARRAY - access an existing message folder as array\n\n## SYNOPSIS\n\nuse Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open(folder => 'inbox');\nuse Mail::Box::Tie::ARRAY;\ntie my(@inbox), 'Mail::Box::Tie::ARRAY', $folder;\n# deprecated, but works too\nuse Mail::Box::Tie;\ntie my(@inbox), 'Mail::Box::Tie', $folder;\nforeach (@inbox) {print $->short}\nprint $->print foreach @inbox;\nmy $emails = @inbox;\nprint $inbox[3];\nprint scalar @inbox;\npush @inbox, Mail::Box::Message->new(...);\ndelete $inbox[6];\nprint $inbox[0]->head->get('status');\nmy $folder = tied @inbox;\nuntie @inbox;\n\n## DESCRIPTION\n\nCertainly when you look at a folder as a list of messages, it is logical to access the folder\nthrough an array.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (2 subsections)\n- **DETAILS** (1 subsections)\n- **SEE ALSO**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Box::Tie::ARRAY",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Box::Tie::ARRAY - access an existing message folder as array",
        "synopsis": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open(folder => 'inbox');\nuse Mail::Box::Tie::ARRAY;\ntie my(@inbox), 'Mail::Box::Tie::ARRAY', $folder;\n# deprecated, but works too\nuse Mail::Box::Tie;\ntie my(@inbox), 'Mail::Box::Tie', $folder;\nforeach (@inbox) {print $->short}\nprint $->print foreach @inbox;\nmy $emails = @inbox;\nprint $inbox[3];\nprint scalar @inbox;\npush @inbox, Mail::Box::Message->new(...);\ndelete $inbox[6];\nprint $inbox[0]->head->get('status');\nmy $folder = tied @inbox;\nuntie @inbox;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 9
                    },
                    {
                        "name": "Tied Interface",
                        "lines": 49
                    }
                ]
            },
            {
                "name": "DETAILS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Folder tied as array",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Box::Tie::ARRAY - access an existing message folder as array\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open(folder => 'inbox');\n\nuse Mail::Box::Tie::ARRAY;\ntie my(@inbox), 'Mail::Box::Tie::ARRAY', $folder;\n\n# deprecated, but works too\nuse Mail::Box::Tie;\ntie my(@inbox), 'Mail::Box::Tie', $folder;\n\nforeach (@inbox) {print $->short}\nprint $->print foreach @inbox;\nmy $emails = @inbox;\n\nprint $inbox[3];\nprint scalar @inbox;\npush @inbox, Mail::Box::Message->new(...);\ndelete $inbox[6];\nprint $inbox[0]->head->get('status');\n\nmy $folder = tied @inbox;\nuntie @inbox;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Certainly when you look at a folder as a list of messages, it is logical to access the folder\nthrough an array.\n\nNot all operations on arrays are supported. Actually, most functions which would reduce the size\nof the array are modified instead to mark messages for deletion.\n\nExamples what you *cannot* do:\n\nshift/unshift/pop/splice @inbox;\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructors",
                        "content": "TIEARRAY('Mail::Box::Tie::ARRAY', FOLDER)\nCreate the tie on an existing folder.\n\nexample: tie an array to a folder\n\nmy $mgr   = Mail::Box::Manager->new;\nmy $inbox = $mgr->new(folder => $ENV{MAIL});\ntie my(@inbox), 'Mail::Box::Tie::Array', ref $inbox, $inbox;\n"
                    },
                    {
                        "name": "Tied Interface",
                        "content": "$obj->DELETE()\nFlag a message to be removed. Be warned that the message stays in the folder, and is not\nremoved before the folder is written.\n\nexample:\n\ndelete $inbox[5];\n$inbox[5]->delete;   #same\n\n$obj->FETCH($index)\nGet the message which is at the indicated location in the list of messages contained in this\nfolder. Deleted messages will be returned as \"undef\".\n\nexample:\n\nprint $inbox[3];     # 4th message in the folder\nprint @inbox[3,0];   # 4th and first of the folder\nprint $inbox[-1];    # last message\n\n$obj->FETCHSIZE()\nReturn the total number of messages in a folder. This is called when the folder-array is\nused in scalar context, for instance.\n\nexample:\n\nif(@inbox > 10)    # contains more than 10 messages?\nmy $nrmsgs = @inbox;\n\n$obj->PUSH(@messages)\nAdd @messages to the end of the folder.\n\nexample:\n\npush @inbox, $newmsg;\n\n$obj->STORE($index, $message)\nRandom message replacement is not permitted --doing so would disturb threads etc. An error\noccurs if you try to do this. The only thing which is allowed is to store a message at the\nfirst free index at the end of the folder (which is also achievable with PUSH()).\n\nexample:\n\n$inbox[8] = $add;\n$inbox[-1] = $add;\npush @inbox, $add;\n\n$obj->STORESIZE($length)\nSets all messages behind from $length to the end of folder to be deleted.\n"
                    }
                ]
            },
            "DETAILS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Folder tied as array",
                        "content": "Limitations\nThis module implements \"TIEARRAY\", \"FETCH\", \"STORE\", \"FETCHSIZE\", \"STORESIZE\", \"DELETE\", \"PUSH\",\nand \"DESTROY\".\n\nThis module does not implement all other methods as described in the Tie::Array documentation,\nbecause the real array of messages is not permitted to shrink or be mutilated.\n"
                    }
                ]
            },
            "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": []
            }
        }
    }
}