1N/Apackage ODBM_File;
1N/A
1N/Ause strict;
1N/Ause warnings;
1N/A
1N/Arequire Tie::Hash;
1N/Ause XSLoader ();
1N/A
1N/Aour @ISA = qw(Tie::Hash);
1N/Aour $VERSION = "1.05";
1N/A
1N/AXSLoader::load 'ODBM_File', $VERSION;
1N/A
1N/A1;
1N/A
1N/A__END__
1N/A
1N/A=head1 NAME
1N/A
1N/AODBM_File - Tied access to odbm files
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use Fcntl; # For O_RDWR, O_CREAT, etc.
1N/A use ODBM_File;
1N/A
1N/A # Now read and change the hash
1N/A $h{newkey} = newvalue;
1N/A print $h{oldkey};
1N/A ...
1N/A
1N/A untie %h;
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AC<ODBM_File> establishes a connection between a Perl hash variable and
1N/Aa file in ODBM_File format;. You can manipulate the data in the file
1N/Ajust as if it were in a Perl hash, but when your program exits, the
1N/Adata will remain in the file, to be used the next time your program
1N/Aruns.
1N/A
1N/AUse C<ODBM_File> with the Perl built-in C<tie> function to establish
1N/Athe connection between the variable and the file. The arguments to
1N/AC<tie> should be:
1N/A
1N/A=over 4
1N/A
1N/A=item 1.
1N/A
1N/AThe hash variable you want to tie.
1N/A
1N/A=item 2.
1N/A
1N/AThe string C<"ODBM_File">. (Ths tells Perl to use the C<ODBM_File>
1N/Apackage to perform the functions of the hash.)
1N/A
1N/A=item 3.
1N/A
1N/AThe name of the file you want to tie to the hash.
1N/A
1N/A=item 4.
1N/A
1N/AFlags. Use one of:
1N/A
1N/A=over 2
1N/A
1N/A=item C<O_RDONLY>
1N/A
1N/ARead-only access to the data in the file.
1N/A
1N/A=item C<O_WRONLY>
1N/A
1N/AWrite-only access to the data in the file.
1N/A
1N/A=item C<O_RDWR>
1N/A
1N/ABoth read and write access.
1N/A
1N/A=back
1N/A
1N/AIf you want to create the file if it does not exist, add C<O_CREAT> to
1N/Aany of these, as in the example. If you omit C<O_CREAT> and the file
1N/Adoes not already exist, the C<tie> call will fail.
1N/A
1N/A=item 5.
1N/A
1N/AThe default permissions to use if a new file is created. The actual
1N/Apermissions will be modified by the user's umask, so you should
1N/Aprobably use 0666 here. (See L<perlfunc/umask>.)
1N/A
1N/A=back
1N/A
1N/A=head1 DIAGNOSTICS
1N/A
1N/AOn failure, the C<tie> call returns an undefined value and probably
1N/Asets C<$!> to contain the reason the file could not be tied.
1N/A
1N/A=head2 C<odbm store returned -1, errno 22, key "..." at ...>
1N/A
1N/AThis warning is emmitted when you try to store a key or a value that
1N/Ais too long. It means that the change was not recorded in the
1N/Adatabase. See BUGS AND WARNINGS below.
1N/A
1N/A=head1 BUGS AND WARNINGS
1N/A
1N/AThere are a number of limits on the size of the data that you can
1N/Astore in the ODBM file. The most important is that the length of a
1N/Akey, plus the length of its associated value, may not exceed 1008
1N/Abytes.
1N/A
1N/ASee L<perlfunc/tie>, L<perldbmfilter>, L<Fcntl>
1N/A
1N/A=cut