CINXE.COM
GDBM_File - Perl5 access to the gdbm library. - Perldoc Browser
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>GDBM_File - Perl5 access to the gdbm library. - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/GDBM_File"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.41.3</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/GDBM_File">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/GDBM_File">5.40.1</a> <a class="dropdown-item" href="/5.40.0/GDBM_File">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/GDBM_File">5.38.3</a> <a class="dropdown-item" href="/5.38.2/GDBM_File">5.38.2</a> <a class="dropdown-item" href="/5.38.1/GDBM_File">5.38.1</a> <a class="dropdown-item" href="/5.38.0/GDBM_File">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/GDBM_File">5.36.3</a> <a class="dropdown-item" href="/5.36.2/GDBM_File">5.36.2</a> <a class="dropdown-item" href="/5.36.1/GDBM_File">5.36.1</a> <a class="dropdown-item" href="/5.36.0/GDBM_File">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/GDBM_File">5.34.3</a> <a class="dropdown-item" href="/5.34.2/GDBM_File">5.34.2</a> <a class="dropdown-item" href="/5.34.1/GDBM_File">5.34.1</a> <a class="dropdown-item" href="/5.34.0/GDBM_File">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/GDBM_File">5.32.1</a> <a class="dropdown-item" href="/5.32.0/GDBM_File">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/GDBM_File">5.30.3</a> <a class="dropdown-item" href="/5.30.2/GDBM_File">5.30.2</a> <a class="dropdown-item" href="/5.30.1/GDBM_File">5.30.1</a> <a class="dropdown-item" href="/5.30.0/GDBM_File">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/GDBM_File">5.28.3</a> <a class="dropdown-item" href="/5.28.2/GDBM_File">5.28.2</a> <a class="dropdown-item" href="/5.28.1/GDBM_File">5.28.1</a> <a class="dropdown-item" href="/5.28.0/GDBM_File">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/GDBM_File">5.26.3</a> <a class="dropdown-item" href="/5.26.2/GDBM_File">5.26.2</a> <a class="dropdown-item" href="/5.26.1/GDBM_File">5.26.1</a> <a class="dropdown-item" href="/5.26.0/GDBM_File">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/GDBM_File">5.24.4</a> <a class="dropdown-item" href="/5.24.3/GDBM_File">5.24.3</a> <a class="dropdown-item" href="/5.24.2/GDBM_File">5.24.2</a> <a class="dropdown-item" href="/5.24.1/GDBM_File">5.24.1</a> <a class="dropdown-item" href="/5.24.0/GDBM_File">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/GDBM_File">5.22.4</a> <a class="dropdown-item" href="/5.22.3/GDBM_File">5.22.3</a> <a class="dropdown-item" href="/5.22.2/GDBM_File">5.22.2</a> <a class="dropdown-item" href="/5.22.1/GDBM_File">5.22.1</a> <a class="dropdown-item" href="/5.22.0/GDBM_File">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/GDBM_File">5.20.3</a> <a class="dropdown-item" href="/5.20.2/GDBM_File">5.20.2</a> <a class="dropdown-item" href="/5.20.1/GDBM_File">5.20.1</a> <a class="dropdown-item" href="/5.20.0/GDBM_File">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/GDBM_File">5.18.4</a> <a class="dropdown-item" href="/5.18.3/GDBM_File">5.18.3</a> <a class="dropdown-item" href="/5.18.2/GDBM_File">5.18.2</a> <a class="dropdown-item" href="/5.18.1/GDBM_File">5.18.1</a> <a class="dropdown-item" href="/5.18.0/GDBM_File">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/GDBM_File">5.16.3</a> <a class="dropdown-item" href="/5.16.2/GDBM_File">5.16.2</a> <a class="dropdown-item" href="/5.16.1/GDBM_File">5.16.1</a> <a class="dropdown-item" href="/5.16.0/GDBM_File">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/GDBM_File">5.14.4</a> <a class="dropdown-item" href="/5.14.3/GDBM_File">5.14.3</a> <a class="dropdown-item" href="/5.14.2/GDBM_File">5.14.2</a> <a class="dropdown-item" href="/5.14.1/GDBM_File">5.14.1</a> <a class="dropdown-item" href="/5.14.0/GDBM_File">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/GDBM_File">5.12.5</a> <a class="dropdown-item" href="/5.12.4/GDBM_File">5.12.4</a> <a class="dropdown-item" href="/5.12.3/GDBM_File">5.12.3</a> <a class="dropdown-item" href="/5.12.2/GDBM_File">5.12.2</a> <a class="dropdown-item" href="/5.12.1/GDBM_File">5.12.1</a> <a class="dropdown-item" href="/5.12.0/GDBM_File">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/GDBM_File">5.10.1</a> <a class="dropdown-item" href="/5.10.0/GDBM_File">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/GDBM_File">5.8.9</a> <a class="dropdown-item" href="/5.8.8/GDBM_File">5.8.8</a> <a class="dropdown-item" href="/5.8.7/GDBM_File">5.8.7</a> <a class="dropdown-item" href="/5.8.6/GDBM_File">5.8.6</a> <a class="dropdown-item" href="/5.8.5/GDBM_File">5.8.5</a> <a class="dropdown-item" href="/5.8.4/GDBM_File">5.8.4</a> <a class="dropdown-item" href="/5.8.3/GDBM_File">5.8.3</a> <a class="dropdown-item" href="/5.8.2/GDBM_File">5.8.2</a> <a class="dropdown-item" href="/5.8.1/GDBM_File">5.8.1</a> <a class="dropdown-item" href="/5.8.0/GDBM_File">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/GDBM_File">5.6.2</a> <a class="dropdown-item" href="/5.6.1/GDBM_File">5.6.1</a> <a class="dropdown-item" href="/5.6.0/GDBM_File">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/GDBM_File">5.005_04</a> <a class="dropdown-item" href="/5.005_03/GDBM_File">5.005_03</a> <a class="dropdown-item" href="/5.005_02/GDBM_File">5.005_02</a> <a class="dropdown-item" href="/5.005_01/GDBM_File">5.005_01</a> <a class="dropdown-item" href="/5.005/GDBM_File">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/GDBM_File">blead</a> <a class="dropdown-item" href="/5.41.10/GDBM_File">5.41.10</a> <a class="dropdown-item" href="/5.41.9/GDBM_File">5.41.9</a> <a class="dropdown-item" href="/5.41.8/GDBM_File">5.41.8</a> <a class="dropdown-item" href="/5.41.7/GDBM_File">5.41.7</a> <a class="dropdown-item" href="/5.41.6/GDBM_File">5.41.6</a> <a class="dropdown-item" href="/5.41.5/GDBM_File">5.41.5</a> <a class="dropdown-item" href="/5.41.4/GDBM_File">5.41.4</a> <a class="dropdown-item active" href="/5.41.3/GDBM_File">5.41.3</a> <a class="dropdown-item" href="/5.41.2/GDBM_File">5.41.2</a> <a class="dropdown-item" href="/5.41.1/GDBM_File">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/GDBM_File">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/GDBM_File">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/GDBM_File">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/GDBM_File">5.39.10</a> <a class="dropdown-item" href="/5.39.9/GDBM_File">5.39.9</a> <a class="dropdown-item" href="/5.39.8/GDBM_File">5.39.8</a> <a class="dropdown-item" href="/5.39.7/GDBM_File">5.39.7</a> <a class="dropdown-item" href="/5.39.6/GDBM_File">5.39.6</a> <a class="dropdown-item" href="/5.39.5/GDBM_File">5.39.5</a> <a class="dropdown-item" href="/5.39.4/GDBM_File">5.39.4</a> <a class="dropdown-item" href="/5.39.3/GDBM_File">5.39.3</a> <a class="dropdown-item" href="/5.39.2/GDBM_File">5.39.2</a> <a class="dropdown-item" href="/5.39.1/GDBM_File">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/GDBM_File">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.41.3/perl">Perl</a> <a class="dropdown-item" href="/5.41.3/perlintro">Intro</a> <a class="dropdown-item" href="/5.41.3/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.41.3/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.41.3/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.41.3/perlop">Operators</a> <a class="dropdown-item" href="/5.41.3/functions">Functions</a> <a class="dropdown-item" href="/5.41.3/variables">Variables</a> <a class="dropdown-item" href="/5.41.3/modules">Modules</a> <a class="dropdown-item" href="/5.41.3/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.41.3/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.41.3/perlcommunity">Community</a> <a class="dropdown-item" href="/5.41.3/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.41.3/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.41.3/GDBM_File">GDBM_File</a> <div id="more"> (<a href="/5.41.3/GDBM_File.txt">source</a>, <a href="https://metacpan.org/pod/GDBM_File">CPAN</a>) </div> <div id="moduleversion">version 1.24</div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.41.3. This is a development version of Perl. </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#SYNOPSIS">SYNOPSIS</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> <ul> <li> <a class="text-decoration-none" href="#Tie">Tie</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#STATIC-METHODS">STATIC METHODS</a> <ul> <li> <a class="text-decoration-none" href="#GDBM_version">GDBM_version</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#ERROR-HANDLING">ERROR HANDLING</a> <ul> <li> <a class="text-decoration-none" href="#$GDBM_File::gdbm_errno">$GDBM_File::gdbm_errno</a> </li> <li> <a class="text-decoration-none" href="#gdbm_check_syserr">gdbm_check_syserr</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#DATABASE-METHODS">DATABASE METHODS</a> <ul> <li> <a class="text-decoration-none" href="#close">close</a> </li> <li> <a class="text-decoration-none" href="#errno">errno</a> </li> <li> <a class="text-decoration-none" href="#syserrno">syserrno</a> </li> <li> <a class="text-decoration-none" href="#strerror">strerror</a> </li> <li> <a class="text-decoration-none" href="#clear_error">clear_error</a> </li> <li> <a class="text-decoration-none" href="#needs_recovery">needs_recovery</a> </li> <li> <a class="text-decoration-none" href="#reorganize">reorganize</a> </li> <li> <a class="text-decoration-none" href="#sync">sync</a> </li> <li> <a class="text-decoration-none" href="#count">count</a> </li> <li> <a class="text-decoration-none" href="#flags">flags</a> </li> <li> <a class="text-decoration-none" href="#dbname">dbname</a> </li> <li> <a class="text-decoration-none" href="#cache_size">cache_size</a> </li> <li> <a class="text-decoration-none" href="#block_size">block_size</a> </li> <li> <a class="text-decoration-none" href="#sync_mode">sync_mode</a> </li> <li> <a class="text-decoration-none" href="#centfree">centfree</a> </li> <li> <a class="text-decoration-none" href="#coalesce">coalesce</a> </li> <li> <a class="text-decoration-none" href="#mmap">mmap</a> </li> <li> <a class="text-decoration-none" href="#mmapsize">mmapsize</a> </li> <li> <a class="text-decoration-none" href="#recover">recover</a> </li> <li> <a class="text-decoration-none" href="#convert">convert</a> </li> <li> <a class="text-decoration-none" href="#dump">dump</a> </li> <li> <a class="text-decoration-none" href="#load">load</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#CRASH-TOLERANCE">CRASH TOLERANCE</a> <ul> <li> <a class="text-decoration-none" href="#crash_tolerance_status">crash_tolerance_status</a> </li> <li> <a class="text-decoration-none" href="#failure_atomic">failure_atomic</a> </li> <li> <a class="text-decoration-none" href="#latest_snapshot">latest_snapshot</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#AVAILABILITY">AVAILABILITY</a> </li> <li> <a class="text-decoration-none" href="#SECURITY-AND-PORTABILITY">SECURITY AND PORTABILITY</a> </li> <li> <a class="text-decoration-none" href="#SEE-ALSO">SEE ALSO</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>GDBM_File - Perl5 access to the gdbm library.</p> <h1 id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">#</a>SYNOPSIS</h1> <pre><code>use GDBM_File; [$db =] tie %hash, 'GDBM_File', $filename, GDBM_WRCREAT, 0640 or die "$GDBM_File::gdbm_errno"; # Use the %hash... $e = $db->errno; $e = $db->syserrno; $str = $db->strerror; $bool = $db->needs_recovery; $db->clear_error; $db->reorganize; $db->sync; $n = $db->count; $n = $db->flags; $str = $db->dbname; $db->cache_size; $db->cache_size($newsize); $n = $db->block_size; $bool = $db->sync_mode; $db->sync_mode($bool); $bool = $db->centfree; $db->centfree($bool); $bool = $db->coalesce; $db->coalesce($bool); $bool = $db->mmap; $size = $db->mmapsize; $db->mmapsize($newsize); $db->recover(%args); untie %hash ;</code></pre> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p><b>GDBM_File</b> is a module which allows Perl programs to make use of the facilities provided by the GNU gdbm library. If you intend to use this module you should really have a copy of the <b>GDBM manual</b> at hand. The manual is avaialble online at <a href="https://www.gnu.org.ua/software/gdbm/manual">https://www.gnu.org.ua/software/gdbm/manual</a>.</p> <p>Most of the <b>gdbm</b> functions are available through the <b>GDBM_File</b> interface.</p> <p>Unlike Perl's built-in hashes, it is not safe to <code>delete</code> the current item from a GDBM_File tied hash while iterating over it with <code>each</code>. This is a limitation of the gdbm library.</p> <h2 id="Tie"><a class="permalink" href="#Tie">#</a>Tie</h2> <p>Use the Perl built-in <b>tie</b> to associate a <b>GDBM</b> database with a Perl hash:</p> <pre><code>tie %hash, 'GDBM_File', $filename, $flags, $mode;</code></pre> <p>Here, <i>$filename</i> is the name of the database file to open or create. <i>$flags</i> is a bitwise OR of <i>access mode</i> and optional <i>modifiers</i>. Access mode is one of:</p> <dl> <dt id="GDBM_READER"><a class="permalink" href="#GDBM_READER">#</a><b>GDBM_READER</b></dt> <dd> <p>Open existing database file in read-only mode.</p> </dd> <dt id="GDBM_WRITER"><a class="permalink" href="#GDBM_WRITER">#</a><b>GDBM_WRITER</b></dt> <dd> <p>Open existing database file in read-write mode.</p> </dd> <dt id="GDBM_WRCREAT"><a class="permalink" href="#GDBM_WRCREAT">#</a><b>GDBM_WRCREAT</b></dt> <dd> <p>If the database file exists, open it in read-write mode. If it doesn't, create it first and open read-write.</p> </dd> <dt id="GDBM_NEWDB"><a class="permalink" href="#GDBM_NEWDB">#</a><b>GDBM_NEWDB</b></dt> <dd> <p>Create new database and open it read-write. If the database already exists, truncate it first.</p> </dd> </dl> <p>A number of modifiers can be OR'd to the access mode. Most of them are rarely needed (see <a href="https://www.gnu.org.ua/software/gdbm/manual/Open.html">https://www.gnu.org.ua/software/gdbm/manual/Open.html</a> for a complete list), but one is worth mentioning. The <b>GDBM_NUMSYNC</b> modifier, when used with <b>GDBM_NEWDB</b>, instructs <b>GDBM</b> to create the database in <i>extended</i> (so called <i>numsync</i>) format. This format is best suited for crash-tolerant implementations. See <b>CRASH TOLERANCE</b> below for more information.</p> <p>The <i>$mode</i> parameter is the file mode for creating new database file. Use an octal constant or a combination of <code>S_I*</code> constants from the <b>Fcntl</b> module. This parameter is used if <i>$flags</i> is <b>GDBM_NEWDB</b> or <b>GDBM_WRCREAT</b>.</p> <p>On success, <b>tie</b> returns an object of class <b>GDBM_File</b>. On failure, it returns <b>undef</b>. It is recommended to always check the return value, to make sure your hash is successfully associated with the database file. See <b>ERROR HANDLING</b> below for examples.</p> <h1 id="STATIC-METHODS"><a class="permalink" href="#STATIC-METHODS">#</a><a id="STATIC"></a>STATIC METHODS</h1> <h2 id="GDBM_version"><a class="permalink" href="#GDBM_version">#</a>GDBM_version</h2> <pre><code>$str = GDBM_File->GDBM_version; @ar = GDBM_File->GDBM_version;</code></pre> <p>Returns the version number of the underlying <b>libgdbm</b> library. In scalar context, returns the library version formatted as string:</p> <pre><code class="plaintext">MINOR.MAJOR[.PATCH][ (GUESS)]</code></pre> <p>where <i>MINOR</i>, <i>MAJOR</i>, and <i>PATCH</i> are version numbers, and <i>GUESS</i> is a guess level (see below).</p> <p>In list context, returns a list:</p> <pre><code class="plaintext">( MINOR, MAJOR, PATCH [, GUESS] )</code></pre> <p>The <i>GUESS</i> component is present only if <b>libgdbm</b> version is 1.8.3 or earlier. This is because earlier releases of <b>libgdbm</b> did not include information about their version and the <b>GDBM_File</b> module has to implement certain guesswork in order to determine it. <i>GUESS</i> is a textual description in string context, and a positive number indicating how rough the guess is in list context. Possible values are:</p> <dl> <dt id="1-exact-guess"><a class="permalink" href="#1-exact-guess">#</a><a id="1"></a><a id="exact-guess"></a>1 - exact guess</dt> <dd> <p>The major and minor version numbers are guaranteed to be correct. The actual patchlevel is most probably guessed right, but can be 1-2 less than indicated.</p> </dd> <dt id="2-approximate"><a class="permalink" href="#2-approximate">#</a><a id="2"></a><a id="approximate"></a>2 - approximate</dt> <dd> <p>The major and minor number are guaranteed to be correct. The patchlevel is set to the upper bound.</p> </dd> <dt id="3-rough-guess"><a class="permalink" href="#3-rough-guess">#</a><a id="3"></a><a id="rough-guess"></a>3 - rough guess</dt> <dd> <p>The version is guaranteed to be not newer than <b><i>MAJOR</i>.<i>MINOR</i></b>.</p> </dd> </dl> <h1 id="ERROR-HANDLING"><a class="permalink" href="#ERROR-HANDLING">#</a><a id="ERROR"></a>ERROR HANDLING</h1> <h2 id="$GDBM_File::gdbm_errno"><a class="permalink" href="#$GDBM_File::gdbm_errno">#</a><a id="GDBM_File::gdbm_errno"></a>$GDBM_File::gdbm_errno</h2> <p>When referenced in numeric context, retrieves the current value of the <b>gdbm_errno</b> variable, i.e. a numeric code describing the state of the most recent operation on any <b>gdbm</b> database. Each numeric code has a symbolic name associated with it. For a comprehensive list of these, see <a href="https://www.gnu.org.ua/software/gdbm/manual/Error-codes.html">https://www.gnu.org.ua/software/gdbm/manual/Error-codes.html</a>. Notice, that this list includes all error codes defined for the most recent version of <b>gdbm</b>. Depending on the actual version of the library <b>GDBM_File</b> is built with, some of these may be missing.</p> <p>In string context, <b>$gdbm_errno</b> returns a human-readable description of the error. If necessary, this description includes the value of <b>$!</b>. This makes it possible to use it in diagnostic messages. For example, the usual tying sequence is</p> <pre><code>tie %hash, 'GDBM_File', $filename, GDBM_WRCREAT, 0640 or die "$GDBM_File::gdbm_errno";</code></pre> <p>The following, more complex, example illustrates how you can fall back to read-only mode if the database file permissions forbid read-write access:</p> <pre><code>use Errno qw(EACCES); unless (tie(%hash, 'GDBM_File', $filename, GDBM_WRCREAT, 0640)) { if ($GDBM_File::gdbm_errno == GDBM_FILE_OPEN_ERROR && $!{EACCES}) { if (tie(%hash, 'GDBM_File', $filename, GDBM_READER, 0640)) { die "$GDBM_File::gdbm_errno"; } } else { die "$GDBM_File::gdbm_errno"; } }</code></pre> <h2 id="gdbm_check_syserr"><a class="permalink" href="#gdbm_check_syserr">#</a>gdbm_check_syserr</h2> <pre><code class="plaintext">if (gdbm_check_syserr(gdbm_errno)) ...</code></pre> <p>Returns true if the system error number (<b>$!</b>) gives more information on the cause of the error.</p> <h1 id="DATABASE-METHODS"><a class="permalink" href="#DATABASE-METHODS">#</a><a id="DATABASE"></a>DATABASE METHODS</h1> <h2 id="close"><a class="permalink" href="#close">#</a>close</h2> <pre><code>$db->close;</code></pre> <p>Closes the database. Normally you would just do <b>untie</b>. However, you will need to use this function if you have explicitly assigned the result of <b>tie</b> to a variable, and wish to release the database to another users. Consider the following code:</p> <pre><code>$db = tie %hash, 'GDBM_File', $filename, GDBM_WRCREAT, 0640; # Do something with %hash or $db... untie %hash; $db->close;</code></pre> <p>In this example, doing <b>untie</b> alone is not enough, since the database would remain referenced by <b>$db</b>, and, as a consequence, the database file would remain locked. Calling <b>$db->close</b> ensures the database file is closed and unlocked.</p> <h2 id="errno"><a class="permalink" href="#errno">#</a>errno</h2> <pre><code>$db->errno</code></pre> <p>Returns the last error status associated with this database. In string context, returns a human-readable description of the error. See also <b>$GDBM_File::gdbm_errno</b> variable above.</p> <h2 id="syserrno"><a class="permalink" href="#syserrno">#</a>syserrno</h2> <pre><code>$db->syserrno</code></pre> <p>Returns the last system error status (C <code>errno</code> variable), associated with this database,</p> <h2 id="strerror"><a class="permalink" href="#strerror">#</a>strerror</h2> <pre><code>$db->strerror</code></pre> <p>Returns textual description of the last error that occurred in this database.</p> <h2 id="clear_error"><a class="permalink" href="#clear_error">#</a>clear_error</h2> <pre><code>$db->clear_error</code></pre> <p>Clear error status.</p> <h2 id="needs_recovery"><a class="permalink" href="#needs_recovery">#</a>needs_recovery</h2> <pre><code>$db->needs_recovery</code></pre> <p>Returns true if the database needs recovery.</p> <h2 id="reorganize"><a class="permalink" href="#reorganize">#</a>reorganize</h2> <pre><code>$db->reorganize;</code></pre> <p>Reorganizes the database.</p> <h2 id="sync"><a class="permalink" href="#sync">#</a>sync</h2> <pre><code>$db->sync;</code></pre> <p>Synchronizes recent changes to the database with its disk copy.</p> <h2 id="count"><a class="permalink" href="#count">#</a>count</h2> <pre><code>$n = $db->count;</code></pre> <p>Returns number of keys in the database.</p> <h2 id="flags"><a class="permalink" href="#flags">#</a>flags</h2> <pre><code>$db->flags;</code></pre> <p>Returns flags passed as 4th argument to <b>tie</b>.</p> <h2 id="dbname"><a class="permalink" href="#dbname">#</a>dbname</h2> <pre><code>$db->dbname;</code></pre> <p>Returns the database name (i.e. 3rd argument to <b>tie</b>.</p> <h2 id="cache_size"><a class="permalink" href="#cache_size">#</a>cache_size</h2> <pre><code>$db->cache_size; $db->cache_size($newsize);</code></pre> <p>Returns the size of the internal <b>GDBM</b> cache for that database.</p> <p>Called with argument, sets the size to <i>$newsize</i>.</p> <h2 id="block_size"><a class="permalink" href="#block_size">#</a>block_size</h2> <pre><code>$db->block_size;</code></pre> <p>Returns the block size of the database.</p> <h2 id="sync_mode"><a class="permalink" href="#sync_mode">#</a>sync_mode</h2> <pre><code>$db->sync_mode; $db->sync_mode($bool);</code></pre> <p>Returns the status of the automatic synchronization mode. Called with argument, enables or disables the sync mode, depending on whether $bool is <b>true</b> or <b>false</b>.</p> <p>When synchronization mode is on (<b>true</b>), any changes to the database are immediately written to the disk. This ensures database consistency in case of any unforeseen errors (e.g. power failures), at the expense of considerable slowdown of operation.</p> <p>Synchronization mode is off by default.</p> <h2 id="centfree"><a class="permalink" href="#centfree">#</a>centfree</h2> <pre><code>$db->centfree; $db->centfree($bool);</code></pre> <p>Returns status of the central free block pool (<b>0</b> - disabled, <b>1</b> - enabled).</p> <p>With argument, changes its status.</p> <p>By default, central free block pool is disabled.</p> <h2 id="coalesce"><a class="permalink" href="#coalesce">#</a>coalesce</h2> <pre><code>$db->coalesce; $db->coalesce($bool);</code></pre> <h2 id="mmap"><a class="permalink" href="#mmap">#</a>mmap</h2> <pre><code>$db->mmap;</code></pre> <p>Returns true if memory mapping is enabled.</p> <p>This method will <b>croak</b> if the <b>libgdbm</b> library is complied without memory mapping support.</p> <h2 id="mmapsize"><a class="permalink" href="#mmapsize">#</a>mmapsize</h2> <pre><code>$db->mmapsize; $db->mmapsize($newsize);</code></pre> <p>If memory mapping is enabled, returns the size of memory mapping. With argument, sets the size to <b>$newsize</b>.</p> <p>This method will <b>croak</b> if the <b>libgdbm</b> library is complied without memory mapping support.</p> <h2 id="recover"><a class="permalink" href="#recover">#</a>recover</h2> <pre><code>$db->recover(%args);</code></pre> <p>Recovers data from a failed database. <b>%args</b> is optional and can contain following keys:</p> <dl> <dt id="err-=>-sub-{-...-}"><a class="permalink" href="#err-=%3E-sub-%7B-...-%7D">#</a><a id="err"></a><a id="err-sub"></a>err => sub { ... }</dt> <dd> <p>Reference to code for detailed error reporting. Upon encountering an error, <b>recover</b> will call this sub with a single argument - a description of the error.</p> </dd> <dt id="backup-=>-\$str"><a class="permalink" href="#backup-=%3E-%5C$str">#</a><a id="backup"></a><a id="backup-str"></a>backup => \$str</dt> <dd> <p>Creates a backup copy of the database before recovery and returns its filename in <b>$str</b>.</p> </dd> <dt id="max_failed_keys-=>-$n"><a class="permalink" href="#max_failed_keys-=%3E-$n">#</a><a id="max_failed_keys"></a><a id="max_failed_keys-n"></a>max_failed_keys => $n</dt> <dd> <p>Maximum allowed number of failed keys. If the actual number becomes equal to <i>$n</i>, <b>recover</b> aborts and returns error.</p> </dd> <dt id="max_failed_buckets-=>-$n"><a class="permalink" href="#max_failed_buckets-=%3E-$n">#</a><a id="max_failed_buckets"></a><a id="max_failed_buckets-n"></a>max_failed_buckets => $n</dt> <dd> <p>Maximum allowed number of failed buckets. If the actual number becomes equal to <i>$n</i>, <b>recover</b> aborts and returns error.</p> </dd> <dt id="max_failures-=>-$n"><a class="permalink" href="#max_failures-=%3E-$n">#</a><a id="max_failures"></a><a id="max_failures-n"></a>max_failures => $n</dt> <dd> <p>Maximum allowed number of failures during recovery.</p> </dd> <dt id="stat-=>-\%hash"><a class="permalink" href="#stat-=%3E-%5C%25hash">#</a><a id="stat"></a><a id="stat-hash"></a>stat => \%hash</dt> <dd> <p>Return recovery statistics in <i>%hash</i>. Upon return, the following keys will be present:</p> <dl> <dt id="recovered_keys"><a class="permalink" href="#recovered_keys">#</a>recovered_keys</dt> <dd> <p>Number of successfully recovered keys.</p> </dd> <dt id="recovered_buckets"><a class="permalink" href="#recovered_buckets">#</a>recovered_buckets</dt> <dd> <p>Number of successfully recovered buckets.</p> </dd> <dt id="failed_keys"><a class="permalink" href="#failed_keys">#</a>failed_keys</dt> <dd> <p>Number of keys that failed to be retrieved.</p> </dd> <dt id="failed_buckets"><a class="permalink" href="#failed_buckets">#</a>failed_buckets</dt> <dd> <p>Number of buckets that failed to be retrieved.</p> </dd> </dl> </dd> </dl> <h2 id="convert"><a class="permalink" href="#convert">#</a>convert</h2> <pre><code>$db->convert($format);</code></pre> <p>Changes the format of the database file referred to by <b>$db</b>.</p> <p>Starting from version 1.20, <b>gdbm</b> supports two database file formats: <i>standard</i> and <i>extended</i>. The former is the traditional database format, used by previous <b>gdbm</b> versions. The <i>extended</i> format contains additional data and is recommended for use in crash tolerant applications.</p> <p><a href="https://www.gnu.org.ua/software/gdbm/manual/Numsync.html">https://www.gnu.org.ua/software/gdbm/manual/Numsync.html</a>, for the discussion of both formats.</p> <p>The <b>$format</b> argument sets the new desired database format. It is <b>GDBM_NUMSYNC</b> to convert the database from standard to extended format, and <b>0</b> to convert it from extended to standard format.</p> <p>If the database is already in the requested format, the function returns success without doing anything.</p> <h2 id="dump"><a class="permalink" href="#dump">#</a>dump</h2> <pre><code>$db->dump($filename, %options)</code></pre> <p>Creates a dump of the database file in <i>$filename</i>. Such file can be used as a backup copy or sent over a wire to recreate the database on another machine. To create a database from the dump file, use the <b>load</b> method.</p> <p><b>GDBM</b> supports two dump formats: old <i>binary</i> and new <i>ascii</i>. The binary format is not portable across architectures and is deprecated. It is supported for backward compatibility. The ascii format is portable and stores additional meta-data about the file. It was introduced with the <b>gdbm</b> version 1.11 and is the preferred dump format. The <b>dump</b> method creates ascii dumps by default.</p> <p>If the named file already exists, the function will refuse to overwrite and will croak an error. If it doesn't exist, it will be created with the mode <b>0666</b> modified by the current <b>umask</b>.</p> <p>These defaults can be altered using the following <i>%options</i>:</p> <dl> <dt id="binary-=>-1"><a class="permalink" href="#binary-=%3E-1">#</a><a id="binary"></a><a id="binary-1"></a><b>binary</b> => 1</dt> <dd> <p>Create dump in <i>binary</i> format.</p> </dd> <dt id="mode-=>-MODE"><a class="permalink" href="#mode-=%3E-MODE">#</a><a id="mode"></a><a id="mode-MODE"></a><b>mode</b> => <i>MODE</i></dt> <dd> <p>Set file mode to <i>MODE</i>.</p> </dd> <dt id="overwrite-=>-1"><a class="permalink" href="#overwrite-=%3E-1">#</a><a id="overwrite"></a><a id="overwrite-1"></a><b>overwrite</b> => 1</dt> <dd> <p>Silently overwrite existing files.</p> </dd> </dl> <h2 id="load"><a class="permalink" href="#load">#</a>load</h2> <pre><code>$db->load($filename, %options)</code></pre> <p>Load the data from the dump file <i>$filename</i> into the database <i>$db</i>. The file must have been previously created using the <b>dump</b> method. File format is recognized automatically. By default, the function will croak if the dump contains a key that already exists in the database. It will silently ignore the failure to restore database mode and/or ownership. These defaults can be altered using the following <i>%options</i>:</p> <dl> <dt id="replace-=>-1"><a class="permalink" href="#replace-=%3E-1">#</a><a id="replace"></a><a id="replace-1"></a><b>replace</b> => 1</dt> <dd> <p>Replace existing keys.</p> </dd> <dt id="restore_mode-=>-0-|-1"><a class="permalink" href="#restore_mode-=%3E-0-%7C-1">#</a><a id="restore_mode"></a><a id="restore_mode-0-1"></a><b>restore_mode</b> => 0 | 1</dt> <dd> <p>If <i>0</i>, don't try to restore the mode of the database file to that stored in the dump.</p> </dd> <dt id="restore_owner-=>-0-|-1"><a class="permalink" href="#restore_owner-=%3E-0-%7C-1">#</a><a id="restore_owner"></a><a id="restore_owner-0-1"></a><b>restore_owner</b> => 0 | 1</dt> <dd> <p>If <i>0</i>, don't try to restore the owner of the database file to that stored in the dump.</p> </dd> <dt id="strict_errors-=>-1"><a class="permalink" href="#strict_errors-=%3E-1">#</a><a id="strict_errors"></a><a id="strict_errors-1"></a><b>strict_errors</b> => 1</dt> <dd> <p>Croak if failed to restore ownership and/or mode.</p> </dd> </dl> <p>The usual sequence to recreate a database from the dump file is:</p> <pre><code>my %hash; my $db = tie %hash, 'GDBM_File', 'a.db', GDBM_NEWDB, 0640; $db->load('a.dump');</code></pre> <h1 id="CRASH-TOLERANCE"><a class="permalink" href="#CRASH-TOLERANCE">#</a><a id="CRASH"></a>CRASH TOLERANCE</h1> <p>Crash tolerance is a new feature that, given appropriate support from the OS and the filesystem, guarantees that a logically consistent recent state of the database can be recovered following a crash, such as power outage, OS kernel panic, or the like.</p> <p>Crash tolerance support appeared in <b>gdbm</b> version 1.21. The theory behind it is explained in "Crashproofing the Original NoSQL Key-Value Store", by Terence Kelly (<a href="https://queue.acm.org/detail.cfm?id=3487353">https://queue.acm.org/detail.cfm?id=3487353</a>). A detailed discussion of the <b>gdbm</b> implementation is available in the <b>GDBM Manual</b> (<a href="https://www.gnu.org.ua/software/gdbm/manual/Crash-Tolerance.html">https://www.gnu.org.ua/software/gdbm/manual/Crash-Tolerance.html</a>). The information below describes the Perl interface.</p> <p>For maximum robustness, we recommend to use <i>extended database format</i> for crash tolerant databases. To create a database in extended format, use the <b>GDBM_NEWDB|GDBM_NUMSYNC</b> when opening the database, e.g.:</p> <pre><code>$db = tie %hash, 'GDBM_File', $filename, GDBM_NEWDB|GDBM_NUMSYNC, 0640;</code></pre> <p>To convert existing database to the extended format, use the <b>convert</b> method, described above, e.g.:</p> <pre><code>$db->convert(GDBM_NUMSYNC);</code></pre> <h2 id="crash_tolerance_status"><a class="permalink" href="#crash_tolerance_status">#</a>crash_tolerance_status</h2> <pre><code>GDBM_File->crash_tolerance_status;</code></pre> <p>This static method returns the status of crash tolerance support. A non-zero value means crash tolerance is compiled in and supported by the operating system.</p> <h2 id="failure_atomic"><a class="permalink" href="#failure_atomic">#</a>failure_atomic</h2> <pre><code>$db->failure_atomic($even, $odd)</code></pre> <p>Enables crash tolerance for the database <b>$db</b>, Arguments are the pathnames of two files that will be created and filled with <i>snapshots</i> of the database file. The two files must not exist when this method is called and must reside on the same filesystem as the database file. This filesystem must be support the <i>reflink</i> operation (https://www.gnu.org.ua/software/gdbm/manual/Filesystems-supporting-crash-tolerance.html>.</p> <p>After a successful call to <b>failure_atomic</b>, every call to <b>$db-</b>sync> method will make an efficient reflink snapshot of the database file in one of these files; consecutive calls to <b>sync</b> alternate between the two, hence the names.</p> <p>The most recent of these files can be used to recover the database after a crash. To select the right snapshot, use the <b>latest_snapshot</b> static method.</p> <h2 id="latest_snapshot"><a class="permalink" href="#latest_snapshot">#</a>latest_snapshot</h2> <pre><code>$file = GDBM_File->latest_snapshot($even, $odd); ($file, $error) = GDBM_File->latest_snapshot($even, $odd);</code></pre> <p>Given the two snapshot names (the ones used previously in a call to <b>failure_atomic</b>), this method selects the one suitable for database recovery, i.e. the file which contains the most recent database snapshot.</p> <p>In scalar context, it returns the selected file name or <b>undef</b> in case of failure.</p> <p>In array context, the returns a list of two elements: the file name and status code. On success, the file name is defined and the code is <b>GDBM_SNAPSHOT_OK</b>. On error, the file name is <b>undef</b>, and the status is one of the following:</p> <dl> <dt id="GDBM_SNAPSHOT_BAD"><a class="permalink" href="#GDBM_SNAPSHOT_BAD">#</a>GDBM_SNAPSHOT_BAD</dt> <dd> <p>Neither snapshot file is applicable. This means that the crash has occurred before a call to <b>failure_atomic</b> completed. In this case, it is best to fall back on a safe backup copy of the data file.</p> </dd> <dt id="GDBM_SNAPSHOT_ERR"><a class="permalink" href="#GDBM_SNAPSHOT_ERR">#</a>GDBM_SNAPSHOT_ERR</dt> <dd> <p>A system error occurred. Examine <b>$!</b> for details. See <https://www.gnu.org.ua/software/gdbm/manual/Crash-recovery.html> for a comprehensive list of error codes and their meaning.</p> </dd> <dt id="GDBM_SNAPSHOT_SAME"><a class="permalink" href="#GDBM_SNAPSHOT_SAME">#</a>GDBM_SNAPSHOT_SAME</dt> <dd> <p>The file modes and modification dates of both snapshot files are exactly the same. This can happen only for databases in standard format.</p> </dd> <dt id="GDBM_SNAPSHOT_SUSPICIOUS"><a class="permalink" href="#GDBM_SNAPSHOT_SUSPICIOUS">#</a>GDBM_SNAPSHOT_SUSPICIOUS</dt> <dd> <p>The <i>numsync</i> counters of the two snapshots differ by more than one. The most probable reason is programmer's error: the two parameters refer to snapshots belonging to different database files.</p> </dd> </dl> <h1 id="AVAILABILITY"><a class="permalink" href="#AVAILABILITY">#</a>AVAILABILITY</h1> <p>gdbm is available from any GNU archive. The master site is <code>ftp.gnu.org</code>, but you are strongly urged to use one of the many mirrors. You can obtain a list of mirror sites from <a href="http://www.gnu.org/order/ftp.html">http://www.gnu.org/order/ftp.html</a>.</p> <h1 id="SECURITY-AND-PORTABILITY"><a class="permalink" href="#SECURITY-AND-PORTABILITY">#</a><a id="SECURITY"></a>SECURITY AND PORTABILITY</h1> <p>GDBM files are not portable across platforms. If you wish to transfer a GDBM file over the wire, dump it to a portable format first.</p> <p><b>Do not accept GDBM files from untrusted sources.</b></p> <p>Robustness of GDBM against corrupted databases depends highly on its version. Versions prior to 1.15 did not implement any validity checking, so that a corrupted or maliciously crafted database file could cause perl to crash or even expose a security vulnerability. Versions between 1.15 and 1.20 were progressively strengthened against invalid inputs. Finally, version 1.21 had undergone extensive fuzzy checking which proved its ability to withstand any kinds of inputs without crashing.</p> <h1 id="SEE-ALSO"><a class="permalink" href="#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1> <p><a href="http://man.he.net/man1/perl">perl(1)</a>, <a href="http://man.he.net/man3/DB_File">DB_File(3)</a>, <a href="/5.41.3/perldbmfilter">perldbmfilter</a>, <a href="http://man.he.net/man3/gdbm">gdbm(3)</a>, <a href="https://www.gnu.org.ua/software/gdbm/manual.html">https://www.gnu.org.ua/software/gdbm/manual.html</a>.</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>