{
    "content": [
        {
            "type": "text",
            "text": "# SDBM_File (man)\n\n## NAME\n\nSDBMFile - Tied access to sdbm files\n\n## SYNOPSIS\n\nuse Fcntl;   # For ORDWR, OCREAT, etc.\nuse SDBMFile;\ntie(%h, 'SDBMFile', 'filename', ORDWR|OCREAT, 0666)\nor die \"Couldn't tie SDBM file 'filename': $!; aborting\";\n# Now read and change the hash\n$h{newkey} = newvalue;\nprint $h{oldkey};\n...\nuntie %h;\n\n## DESCRIPTION\n\n\"SDBMFile\" establishes a connection between a Perl hash variable and a file in SDBMFile\nformat.  You can manipulate the data in the file just as if it were in a Perl hash, but when\nyour program exits, the data will remain in the file, to be used the next time your program\nruns.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **EXPORTS**\n- **DIAGNOSTICS** (1 subsections)\n- **SECURITY WARNING** (1 subsections)\n- **BUGS AND WARNINGS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "SDBM_File",
        "section": "",
        "mode": "man",
        "summary": "SDBMFile - Tied access to sdbm files",
        "synopsis": "use Fcntl;   # For ORDWR, OCREAT, etc.\nuse SDBMFile;\ntie(%h, 'SDBMFile', 'filename', ORDWR|OCREAT, 0666)\nor die \"Couldn't tie SDBM file 'filename': $!; aborting\";\n# Now read and change the hash\n$h{newkey} = newvalue;\nprint $h{oldkey};\n...\nuntie %h;",
        "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": 5,
                "subsections": [
                    {
                        "name": "Tie",
                        "lines": 35
                    }
                ]
            },
            {
                "name": "EXPORTS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 3,
                "subsections": [
                    {
                        "name": "\"sdbm store returned -1, errno 22, key \"...\" at ...\"",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "SECURITY WARNING",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Do not accept SDBM files from untrusted sources!",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "BUGS AND WARNINGS",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "SDBMFile - Tied access to sdbm files\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Fcntl;   # For ORDWR, OCREAT, etc.\nuse SDBMFile;\n\ntie(%h, 'SDBMFile', 'filename', ORDWR|OCREAT, 0666)\nor die \"Couldn't tie SDBM file 'filename': $!; aborting\";\n\n# Now read and change the hash\n$h{newkey} = newvalue;\nprint $h{oldkey};\n...\n\nuntie %h;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"SDBMFile\" establishes a connection between a Perl hash variable and a file in SDBMFile\nformat.  You can manipulate the data in the file just as if it were in a Perl hash, but when\nyour program exits, the data will remain in the file, to be used the next time your program\nruns.\n",
                "subsections": [
                    {
                        "name": "Tie",
                        "content": "Use \"SDBMFile\" with the Perl built-in \"tie\" function to establish the connection between the\nvariable and the file.\n\ntie %hash, 'SDBMFile', $basename, $modeflags, $perms;\n\ntie %hash, 'SDBMFile', $dirfile,  $modeflags, $perms, $pagfilename;\n\n$basename is the base filename for the database.  The database is two files with \".dir\" and\n\".pag\" extensions appended to $basename,\n\n$basename.dir     (or .sdbmdir on VMS, per DIRFEXT constant)\n$basename.pag\n\nThe two filenames can also be given separately in full as $dirfile and $pagfilename.  This\nsuits for two files without \".dir\" and \".pag\" extensions, perhaps for example two files from\nFile::Temp.\n\n$modeflags can be the following constants from the \"Fcntl\" module (in the style of the\nopen(2) system call),\n\nORDONLY          read-only access\nOWRONLY          write-only access\nORDWR            read and write access\n\nIf you want to create the file if it does not already exist then bitwise-OR (\"|\") \"OCREAT\"\ntoo.  If you omit \"OCREAT\" and the database does not already exist then the \"tie\" call will\nfail.\n\nOCREAT           create database if doesn't already exist\n\n$perms is the file permissions bits to use if new database files are created.  This parameter\nis mandatory even when not creating a new database.  The permissions will be reduced by the\nuser's umask so the usual value here would be 0666, or if some very private data then 0600.\n(See \"umask\" in perlfunc.)\n"
                    }
                ]
            },
            "EXPORTS": {
                "content": "SDBMFile optionally exports the following constants:\n\n•   \"PAGFEXT\" - the extension used for the page file, usually \".pag\".\n\n•   \"DIRFEXT\" - the extension used for the directory file, \".dir\" everywhere but VMS, where\nit is \".sdbmdir\".\n\n•   \"PAIRMAX\" - the maximum size of a stored hash entry, including the length of both the key\nand value.\n\nThese constants can also be used with fully qualified names, eg. \"SDBMFile::PAGFEXT\".\n",
                "subsections": []
            },
            "DIAGNOSTICS": {
                "content": "On failure, the \"tie\" call returns an undefined value and probably sets $! to contain the\nreason the file could not be tied.\n",
                "subsections": [
                    {
                        "name": "\"sdbm store returned -1, errno 22, key \"...\" at ...\"",
                        "content": "This warning is emitted when you try to store a key or a value that is too long.  It means\nthat the change was not recorded in the database.  See BUGS AND WARNINGS below.\n"
                    }
                ]
            },
            "SECURITY WARNING": {
                "content": "",
                "subsections": [
                    {
                        "name": "Do not accept SDBM files from untrusted sources!",
                        "content": "The sdbm file format was designed for speed and convenience, not for portability or security.\nA maliciously crafted file might cause perl to crash or even expose a security vulnerability.\n"
                    }
                ]
            },
            "BUGS AND WARNINGS": {
                "content": "There are a number of limits on the size of the data that you can store in the SDBM file.\nThe most important is that the length of a key, plus the length of its associated value, may\nnot exceed 1008 bytes.\n\nSee \"tie\" in perlfunc, perldbmfilter, Fcntl\n\n\n\nperl v5.34.0                                 2025-07-25                             SDBMFile(3perl)",
                "subsections": []
            }
        }
    }
}