8 our @ISA = qw(Tie::Hash);
9 our $VERSION = "1.02" ;
11 XSLoader::load 'SDBM_File', $VERSION;
19 SDBM_File - Tied access to sdbm files
23 use Fcntl; # For O_RDWR, O_CREAT, etc.
26 tie(%h, 'SDBM_File', 'filename', O_RDWR|O_CREAT, 0666)
27 or die "Couldn't tie SDBM file 'filename': $!; aborting";
29 # Now read and change the hash
30 $h{newkey} = newvalue;
38 C<SDBM_File> establishes a connection between a Perl hash variable and
39 a file in SDBM_File format;. You can manipulate the data in the file
40 just as if it were in a Perl hash, but when your program exits, the
41 data will remain in the file, to be used the next time your program
44 Use C<SDBM_File> with the Perl built-in C<tie> function to establish
45 the connection between the variable and the file. The arguments to
52 The hash variable you want to tie.
56 The string C<"SDBM_File">. (Ths tells Perl to use the C<SDBM_File>
57 package to perform the functions of the hash.)
61 The name of the file you want to tie to the hash.
71 Read-only access to the data in the file.
75 Write-only access to the data in the file.
79 Both read and write access.
83 If you want to create the file if it does not exist, add C<O_CREAT> to
84 any of these, as in the example. If you omit C<O_CREAT> and the file
85 does not already exist, the C<tie> call will fail.
89 The default permissions to use if a new file is created. The actual
90 permissions will be modified by the user's umask, so you should
91 probably use 0666 here. (See L<perlfunc/umask>.)
97 On failure, the C<tie> call returns an undefined value and probably
98 sets C<$!> to contain the reason the file could not be tied.
100 =head2 C<sdbm store returned -1, errno 22, key "..." at ...>
102 This warning is emmitted when you try to store a key or a value that
103 is too long. It means that the change was not recorded in the
104 database. See BUGS AND WARNINGS below.
106 =head1 BUGS AND WARNINGS
108 There are a number of limits on the size of the data that you can
109 store in the SDBM file. The most important is that the length of a
110 key, plus the length of its associated value, may not exceed 1008
113 See L<perlfunc/tie>, L<perldbmfilter>, L<Fcntl>