9 our @ISA = qw(Tie::Hash);
10 our $VERSION = "1.18";
20 ODBM_File - Tied access to odbm files
24 use Fcntl; # For O_RDWR, O_CREAT, etc.
27 # Now read and change the hash
28 $h{newkey} = newvalue;
36 C<ODBM_File> establishes a connection between a Perl hash variable and
37 a file in ODBM_File format;. You can manipulate the data in the file
38 just as if it were in a Perl hash, but when your program exits, the
39 data will remain in the file, to be used the next time your program
42 Use C<ODBM_File> with the Perl built-in C<tie> function to establish
43 the connection between the variable and the file. The arguments to
50 The hash variable you want to tie.
54 The string C<"ODBM_File">. (Ths tells Perl to use the C<ODBM_File>
55 package to perform the functions of the hash.)
59 The name of the file you want to tie to the hash.
69 Read-only access to the data in the file.
73 Write-only access to the data in the file.
77 Both read and write access.
81 If you want to create the file if it does not exist, add C<O_CREAT> to
82 any of these, as in the example. If you omit C<O_CREAT> and the file
83 does not already exist, the C<tie> call will fail.
87 The default permissions to use if a new file is created. The actual
88 permissions will be modified by the user's umask, so you should
89 probably use 0666 here. (See L<perlfunc/umask>.)
95 On failure, the C<tie> call returns an undefined value and probably
96 sets C<$!> to contain the reason the file could not be tied.
98 =head2 C<odbm store returned -1, errno 22, key "..." at ...>
100 This warning is emitted when you try to store a key or a value that
101 is too long. It means that the change was not recorded in the
102 database. See BUGS AND WARNINGS below.
104 =head1 SECURITY AND PORTABILITY
106 B<Do not accept ODBM files from untrusted sources.>
108 On modern Linux systems these are typically GDBM files, which are not
109 portable across platforms.
111 The GDBM documentation doesn't imply that files from untrusted sources
112 can be safely used with C<libgdbm>.
114 Systems that don't use GDBM compatibilty for old dbm support will be
115 using a platform specific library, possibly inherited from BSD
116 systems, where it may or may not be safe to use an untrusted file.
118 A maliciously crafted file might cause perl to crash or even expose a
119 security vulnerability.
121 =head1 BUGS AND WARNINGS
123 There are a number of limits on the size of the data that you can
124 store in the ODBM file. The most important is that the length of a
125 key, plus the length of its associated value, may not exceed 1008
128 See L<perlfunc/tie>, L<perldbmfilter>, L<Fcntl>