{
    "content": [
        {
            "type": "text",
            "text": "# IPC::SharedMem (perldoc)\n\n**Summary:** IPC::SharedMem - SysV Shared Memory IPC object class\n\n**Synopsis:** use IPC::SysV qw(IPCPRIVATE SIRUSR SIWUSR);\nuse IPC::SharedMem;\n$shm = IPC::SharedMem->new(IPCPRIVATE, 8, SIRWXU);\n$shm->write(pack(\"S\", 4711), 2, 2);\n$data = $shm->read(0, 2);\n$ds = $shm->stat;\n$shm->remove;\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (13 lines)\n- **DESCRIPTION** (2 lines)\n- **METHODS** (61 lines)\n- **SEE ALSO** (2 lines)\n- **AUTHORS** (2 lines)\n- **COPYRIGHT** (7 lines)\n\n## Full Content\n\n### NAME\n\nIPC::SharedMem - SysV Shared Memory IPC object class\n\n### SYNOPSIS\n\nuse IPC::SysV qw(IPCPRIVATE SIRUSR SIWUSR);\nuse IPC::SharedMem;\n\n$shm = IPC::SharedMem->new(IPCPRIVATE, 8, SIRWXU);\n\n$shm->write(pack(\"S\", 4711), 2, 2);\n\n$data = $shm->read(0, 2);\n\n$ds = $shm->stat;\n\n$shm->remove;\n\n### DESCRIPTION\n\nA class providing an object based interface to SysV IPC shared memory.\n\n### METHODS\n\nnew ( KEY , SIZE , FLAGS )\nCreates a new shared memory segment of \"SIZE\" bytes size associated with \"KEY\". A new\nsegment is created if\n\n*   \"KEY\" is equal to \"IPCPRIVATE\"\n\n*   \"KEY\" does not already have a shared memory segment associated with it, and \"*FLAGS* &\nIPCCREAT\" is true.\n\nOn creation of a new shared memory segment \"FLAGS\" is used to set the permissions. Be\ncareful not to set any flags that the Sys V IPC implementation does not allow: in some\nsystems setting execute bits makes the operations fail.\n\nid  Returns the shared memory identifier.\n\nread ( POS, SIZE )\nRead \"SIZE\" bytes from the shared memory segment at \"POS\". Returns the string read, or\n\"undef\" if there was an error. The return value becomes tainted. See shmread.\n\nwrite ( STRING, POS, SIZE )\nWrite \"SIZE\" bytes to the shared memory segment at \"POS\". Returns true if successful, or\nfalse if there is an error. See shmwrite.\n\nremove\nRemove the shared memory segment from the system or mark it as removed as long as any\nprocesses are still attached to it.\n\nisremoved\nReturns true if the shared memory segment has been removed or marked for removal.\n\nstat\nReturns an object of type \"IPC::SharedMem::stat\" which is a sub-class of \"Class::Struct\". It\nprovides the following fields. For a description of these fields see you system\ndocumentation.\n\nuid\ngid\ncuid\ncgid\nmode\nsegsz\nlpid\ncpid\nnattch\natime\ndtime\nctime\n\nattach ( [FLAG] )\nPermanently attach to the shared memory segment. When a \"IPC::SharedMem\" object is attached,\nit will use memread and memwrite instead of shmread and shmwrite for accessing the shared\nmemory segment. Returns true if successful, or false on error. See shmat(2).\n\ndetach\nDetach from the shared memory segment that previously has been attached to. Returns true if\nsuccessful, or false on error. See shmdt(2).\n\naddr\nReturns the address of the shared memory that has been attached to in a format suitable for\nuse with \"pack('P')\". Returns \"undef\" if the shared memory has not been attached.\n\n### SEE ALSO\n\nIPC::SysV, Class::Struct\n\n### AUTHORS\n\nMarcus Holland-Moritz <mhx@cpan.org>\n\n### COPYRIGHT\n\nVersion 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz.\n\nVersion 1.x, Copyright (c) 1997, Graham Barr.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\n"
        }
    ],
    "structuredContent": {
        "command": "IPC::SharedMem",
        "section": "",
        "mode": "perldoc",
        "summary": "IPC::SharedMem - SysV Shared Memory IPC object class",
        "synopsis": "use IPC::SysV qw(IPCPRIVATE SIRUSR SIWUSR);\nuse IPC::SharedMem;\n$shm = IPC::SharedMem->new(IPCPRIVATE, 8, SIRWXU);\n$shm->write(pack(\"S\", 4711), 2, 2);\n$data = $shm->read(0, 2);\n$ds = $shm->stat;\n$shm->remove;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 61,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "IPC::SharedMem - SysV Shared Memory IPC object class\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use IPC::SysV qw(IPCPRIVATE SIRUSR SIWUSR);\nuse IPC::SharedMem;\n\n$shm = IPC::SharedMem->new(IPCPRIVATE, 8, SIRWXU);\n\n$shm->write(pack(\"S\", 4711), 2, 2);\n\n$data = $shm->read(0, 2);\n\n$ds = $shm->stat;\n\n$shm->remove;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "A class providing an object based interface to SysV IPC shared memory.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "new ( KEY , SIZE , FLAGS )\nCreates a new shared memory segment of \"SIZE\" bytes size associated with \"KEY\". A new\nsegment is created if\n\n*   \"KEY\" is equal to \"IPCPRIVATE\"\n\n*   \"KEY\" does not already have a shared memory segment associated with it, and \"*FLAGS* &\nIPCCREAT\" is true.\n\nOn creation of a new shared memory segment \"FLAGS\" is used to set the permissions. Be\ncareful not to set any flags that the Sys V IPC implementation does not allow: in some\nsystems setting execute bits makes the operations fail.\n\nid  Returns the shared memory identifier.\n\nread ( POS, SIZE )\nRead \"SIZE\" bytes from the shared memory segment at \"POS\". Returns the string read, or\n\"undef\" if there was an error. The return value becomes tainted. See shmread.\n\nwrite ( STRING, POS, SIZE )\nWrite \"SIZE\" bytes to the shared memory segment at \"POS\". Returns true if successful, or\nfalse if there is an error. See shmwrite.\n\nremove\nRemove the shared memory segment from the system or mark it as removed as long as any\nprocesses are still attached to it.\n\nisremoved\nReturns true if the shared memory segment has been removed or marked for removal.\n\nstat\nReturns an object of type \"IPC::SharedMem::stat\" which is a sub-class of \"Class::Struct\". It\nprovides the following fields. For a description of these fields see you system\ndocumentation.\n\nuid\ngid\ncuid\ncgid\nmode\nsegsz\nlpid\ncpid\nnattch\natime\ndtime\nctime\n\nattach ( [FLAG] )\nPermanently attach to the shared memory segment. When a \"IPC::SharedMem\" object is attached,\nit will use memread and memwrite instead of shmread and shmwrite for accessing the shared\nmemory segment. Returns true if successful, or false on error. See shmat(2).\n\ndetach\nDetach from the shared memory segment that previously has been attached to. Returns true if\nsuccessful, or false on error. See shmdt(2).\n\naddr\nReturns the address of the shared memory that has been attached to in a format suitable for\nuse with \"pack('P')\". Returns \"undef\" if the shared memory has not been attached.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "IPC::SysV, Class::Struct\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Marcus Holland-Moritz <mhx@cpan.org>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Version 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz.\n\nVersion 1.x, Copyright (c) 1997, Graham Barr.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}