{
    "content": [
        {
            "type": "text",
            "text": "# Tie::Array (perldoc)\n\n**Summary:** Tie::Array - base class for tied arrays\n\n**Synopsis:** package Tie::NewArray;\nuse Tie::Array;\n@ISA = ('Tie::Array');\n# mandatory methods\nsub TIEARRAY { ... }\nsub FETCH { ... }\nsub FETCHSIZE { ... }\nsub STORE { ... }       # mandatory if elements writeable\nsub STORESIZE { ... }   # mandatory if elements can be added/deleted\nsub EXISTS { ... }      # mandatory if exists() expected to work\nsub DELETE { ... }      # mandatory if delete() expected to work\n# optional methods - for efficiency\nsub CLEAR { ... }\nsub PUSH { ... }\nsub POP { ... }\nsub SHIFT { ... }\nsub UNSHIFT { ... }\nsub SPLICE { ... }\nsub EXTEND { ... }\nsub DESTROY { ... }\npackage Tie::NewStdArray;\nuse Tie::Array;\n@ISA = ('Tie::StdArray');\n# all methods provided by default\npackage main;\n$object = tie @somearray,'Tie::NewArray';\n$object = tie @somearray,'Tie::StdArray';\n$object = tie @somearray,'Tie::NewStdArray';\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (37 lines)\n- **DESCRIPTION** (94 lines)\n- **CAVEATS** (4 lines)\n- **AUTHOR** (2 lines)\n\n## Full Content\n\n### NAME\n\nTie::Array - base class for tied arrays\n\n### SYNOPSIS\n\npackage Tie::NewArray;\nuse Tie::Array;\n@ISA = ('Tie::Array');\n\n# mandatory methods\nsub TIEARRAY { ... }\nsub FETCH { ... }\nsub FETCHSIZE { ... }\n\nsub STORE { ... }       # mandatory if elements writeable\nsub STORESIZE { ... }   # mandatory if elements can be added/deleted\nsub EXISTS { ... }      # mandatory if exists() expected to work\nsub DELETE { ... }      # mandatory if delete() expected to work\n\n# optional methods - for efficiency\nsub CLEAR { ... }\nsub PUSH { ... }\nsub POP { ... }\nsub SHIFT { ... }\nsub UNSHIFT { ... }\nsub SPLICE { ... }\nsub EXTEND { ... }\nsub DESTROY { ... }\n\npackage Tie::NewStdArray;\nuse Tie::Array;\n\n@ISA = ('Tie::StdArray');\n\n# all methods provided by default\n\npackage main;\n\n$object = tie @somearray,'Tie::NewArray';\n$object = tie @somearray,'Tie::StdArray';\n$object = tie @somearray,'Tie::NewStdArray';\n\n### DESCRIPTION\n\nThis module provides methods for array-tying classes. See perltie for a\nlist of the functions required in order to tie an array to a package.\nThe basic Tie::Array package provides stub \"DESTROY\", and \"EXTEND\"\nmethods that do nothing, stub \"DELETE\" and \"EXISTS\" methods that croak()\nif the delete() or exists() builtins are ever called on the tied array,\nand implementations of \"PUSH\", \"POP\", \"SHIFT\", \"UNSHIFT\", \"SPLICE\" and\n\"CLEAR\" in terms of basic \"FETCH\", \"STORE\", \"FETCHSIZE\", \"STORESIZE\".\n\nThe Tie::StdArray package provides efficient methods required for tied\narrays which are implemented as blessed references to an \"inner\" perl\narray. It inherits from Tie::Array, and should cause tied arrays to\nbehave exactly like standard arrays, allowing for selective overloading\nof methods.\n\nFor developers wishing to write their own tied arrays, the required\nmethods are briefly defined below. See the perltie section for more\ndetailed descriptive, as well as example code:\n\nTIEARRAY classname, LIST\nThe class method is invoked by the command \"tie @array, classname\".\nAssociates an array instance with the specified class. \"LIST\" would\nrepresent additional arguments (along the lines of AnyDBMFile and\ncompatriots) needed to complete the association. The method should\nreturn an object of a class which provides the methods below.\n\nSTORE this, index, value\nStore datum *value* into *index* for the tied array associated with\nobject *this*. If this makes the array larger then class's mapping\nof \"undef\" should be returned for new positions.\n\nFETCH this, index\nRetrieve the datum in *index* for the tied array associated with\nobject *this*.\n\nFETCHSIZE this\nReturns the total number of items in the tied array associated with\nobject *this*. (Equivalent to \"scalar(@array)\").\n\nSTORESIZE this, count\nSets the total number of items in the tied array associated with\nobject *this* to be *count*. If this makes the array larger then\nclass's mapping of \"undef\" should be returned for new positions. If\nthe array becomes smaller then entries beyond count should be\ndeleted.\n\nEXTEND this, count\nInformative call that array is likely to grow to have *count*\nentries. Can be used to optimize allocation. This method need do\nnothing.\n\nEXISTS this, key\nVerify that the element at index *key* exists in the tied array\n*this*.\n\nThe Tie::Array implementation is a stub that simply croaks.\n\nDELETE this, key\nDelete the element at index *key* from the tied array *this*.\n\nThe Tie::Array implementation is a stub that simply croaks.\n\nCLEAR this\nClear (remove, delete, ...) all values from the tied array\nassociated with object *this*.\n\nDESTROY this\nNormal object destructor method.\n\nPUSH this, LIST\nAppend elements of LIST to the array.\n\nPOP this\nRemove last element of the array and return it.\n\nSHIFT this\nRemove the first element of the array (shifting other elements down)\nand return it.\n\nUNSHIFT this, LIST\nInsert LIST elements at the beginning of the array, moving existing\nelements up to make room.\n\nSPLICE this, offset, length, LIST\nPerform the equivalent of \"splice\" on the array.\n\n*offset* is optional and defaults to zero, negative values count\nback from the end of the array.\n\n*length* is optional and defaults to rest of the array.\n\n*LIST* may be empty.\n\nReturns a list of the original *length* elements at *offset*.\n\n### CAVEATS\n\nThere is no support at present for tied @ISA. There is a potential\nconflict between magic entries needed to notice setting of @ISA, and\nthose needed to implement 'tie'.\n\n### AUTHOR\n\nNick Ing-Simmons <nik@tiuk.ti.com>\n\n"
        }
    ],
    "structuredContent": {
        "command": "Tie::Array",
        "section": "",
        "mode": "perldoc",
        "summary": "Tie::Array - base class for tied arrays",
        "synopsis": "package Tie::NewArray;\nuse Tie::Array;\n@ISA = ('Tie::Array');\n# mandatory methods\nsub TIEARRAY { ... }\nsub FETCH { ... }\nsub FETCHSIZE { ... }\nsub STORE { ... }       # mandatory if elements writeable\nsub STORESIZE { ... }   # mandatory if elements can be added/deleted\nsub EXISTS { ... }      # mandatory if exists() expected to work\nsub DELETE { ... }      # mandatory if delete() expected to work\n# optional methods - for efficiency\nsub CLEAR { ... }\nsub PUSH { ... }\nsub POP { ... }\nsub SHIFT { ... }\nsub UNSHIFT { ... }\nsub SPLICE { ... }\nsub EXTEND { ... }\nsub DESTROY { ... }\npackage Tie::NewStdArray;\nuse Tie::Array;\n@ISA = ('Tie::StdArray');\n# all methods provided by default\npackage main;\n$object = tie @somearray,'Tie::NewArray';\n$object = tie @somearray,'Tie::StdArray';\n$object = tie @somearray,'Tie::NewStdArray';",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 37,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 94,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            }
        ]
    }
}