2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <title>ODBM_File - Tied access to odbm files
</title>
6 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
7 <link rev=
"made" href=
"mailto:" />
10 <body style=
"background-color: white">
11 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
12 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
13 <big><strong><span class=
"block"> ODBM_File - Tied access to odbm files
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
22 <li><a href=
"#name">NAME
</a></li>
23 <li><a href=
"#synopsis">SYNOPSIS
</a></li>
24 <li><a href=
"#description">DESCRIPTION
</a></li>
25 <li><a href=
"#diagnostics">DIAGNOSTICS
</a></li>
28 <li><a href=
"#odbm_store_returned_1__errno_22__key_____at____"><code>odbm store returned -
1, errno
22, key
"...
" at ...
</code></a></li>
31 <li><a href=
"#bugs_and_warnings">BUGS AND WARNINGS
</a></li>
38 <h1><a name=
"name">NAME
</a></h1>
39 <p>ODBM_File - Tied access to odbm files
</p>
43 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
45 use Fcntl; # For O_RDWR, O_CREAT, etc.
48 # Now read and change the hash
49 $h{newkey} = newvalue;
57 <h1><a name=
"description">DESCRIPTION
</a></h1>
58 <p><code>ODBM_File
</code> establishes a connection between a Perl hash variable and
59 a file in ODBM_File format;. You can manipulate the data in the file
60 just as if it were in a Perl hash, but when your program exits, the
61 data will remain in the file, to be used the next time your program
63 <p>Use
<code>ODBM_File
</code> with the Perl built-in
<code>tie
</code> function to establish
64 the connection between the variable and the file. The arguments to
65 <code>tie
</code> should be:
</p>
68 <p>The hash variable you want to tie.
</p>
71 <p>The string
<code>"ODBM_File
"</code>. (Ths tells Perl to use the
<code>ODBM_File
</code>
72 package to perform the functions of the hash.)
</p>
75 <p>The name of the file you want to tie to the hash.
</p>
78 <p>Flags. Use one of:
</p>
80 <dt><strong><a name=
"item_o_rdonly"><code>O_RDONLY
</code></a></strong>
83 <p>Read-only access to the data in the file.
</p>
86 <dt><strong><a name=
"item_o_wronly"><code>O_WRONLY
</code></a></strong>
89 <p>Write-only access to the data in the file.
</p>
92 <dt><strong><a name=
"item_o_rdwr"><code>O_RDWR
</code></a></strong>
95 <p>Both read and write access.
</p>
99 <p>If you want to create the file if it does not exist, add
<code>O_CREAT
</code> to
100 any of these, as in the example. If you omit
<code>O_CREAT
</code> and the file
101 does not already exist, the
<code>tie
</code> call will fail.
</p>
103 <p>The default permissions to use if a new file is created. The actual
104 permissions will be modified by the user's umask, so you should
105 probably use
0666 here. (See
<a href=
"file://C|\msysgit\mingw\html/pod/perlfunc.html#item_umask">umask in the perlfunc manpage
</a>.)
</p>
111 <h1><a name=
"diagnostics">DIAGNOSTICS
</a></h1>
112 <p>On failure, the
<code>tie
</code> call returns an undefined value and probably
113 sets
<a href=
"file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>$!
</code></a> to contain the reason the file could not be tied.
</p>
116 <h2><a name=
"odbm_store_returned_1__errno_22__key_____at____"><code>odbm store returned -
1, errno
22, key
"...
" at ...
</code></a></h2>
117 <p>This warning is emitted when you try to store a key or a value that
118 is too long. It means that the change was not recorded in the
119 database. See BUGS AND WARNINGS below.
</p>
123 <h1><a name=
"bugs_and_warnings">BUGS AND WARNINGS
</a></h1>
124 <p>There are a number of limits on the size of the data that you can
125 store in the ODBM file. The most important is that the length of a
126 key, plus the length of its associated value, may not exceed
1008
128 <p>See
<a href=
"file://C|\msysgit\mingw\html/pod/perlfunc.html#tie">tie in the perlfunc manpage
</a>,
<a href=
"file://C|\msysgit\mingw\html/pod/perldbmfilter.html">the perldbmfilter manpage
</a>,
<a href=
"file://C|\msysgit\mingw\html/lib/Fcntl.html">the Fcntl manpage
</a></p>
129 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
130 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
131 <big><strong><span class=
"block"> ODBM_File - Tied access to odbm files
</span></strong></big>